Write some Java code that allows a program to read type-safe int values. A Scanner object with the identifier scan has been declared and properly initialized for you. Include code to store the value of the int being read in when it is safe to do so and to re-prompt the user if they enter a bad value.
Scanner scan = new Scanner(System.in);
System.out.println("Please enter an integer value: ");
a) scan.nextInt();
b) scan.nextLine();
c) scan.next();
d) scan.nextDouble();

Q&A Education