In the catch block, I'm trying to correct for user bad-input issues. When testing it, if I use the "break" keyword, it doesn't jump to the initial question. If I use "continue", it loops infinitely. "Sc.next();" doesn't seem to resolve it either.
Here's the relevant part of the code.
public class ComputerAge {
private static int age;
private static int year;
private static int month;
private static int date;
private static Calendar birthdate;
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.print("Enter the numeral representing your birth month: ");
do {
try {
month = sc.nextInt();
} catch (InputMismatchException ime){
System.out.println("Your respone must be a whole number");
break;
}
} while (!sc.hasNextInt());