The following snippet of code inputs an integer and outputs it:
int num=0; Scanner kbd = new Scanner(System.in); num = kbd.nextInt(); System.out.println(num);
Run this program but enter text instead of an integer. The program should crash and tell you what kind of exception was thrown by the nextInt method. Wrap this code inside a try/catch block where you catch the exception that is thrown. Add a loop so the user must enter the number again if text is entered.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.