When I run the below method and intentionally input a letter when a number is expected, I get a never-ending loop that doesn't prompt for more input. Why?
private static int intInput() //Asks the user for an int and returns the input. { Scanner genericIntScan = new Scanner(System.in); boolean itsAnInt = false; int genericInt = 0; while(itsAnInt==false) { try { genericInt = genericIntScan.nextInt(); itsAnInt = true; } catch(InputMismatchException ime) { System.out.println("\nYou're supposed to type in a number. Try again."); itsAnInt = false; } } return genericInt; }