> Java help #1?

Java help #1?

Posted at: 2014-12-18 
How would you prompt a user for an int value and input it using the Scanner class into the variable x and prompt the user for a double value and input it into the variable y?

import java.util.Scanner;

public class Example {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter int: ");

int i = sc.nextInt();

System.out.print("Enter double: ");

double d = sc.nextDouble();

System.out.println("i: " + i);

System.out.println("d: " + d);

}

}

How would you prompt a user for an int value and input it using the Scanner class into the variable x and prompt the user for a double value and input it into the variable y?