The purpose of this was to ensure that the user does not receive any mismatch errors. Every time they enter a String by accident, I want the program to say "Sorry, please choose exercises from above" and give them the option to type an answer again without crashing. Currently, if the user types in a string, the loop skips the if statement and continues onto the else statement for ever until you manually terminate it.
int program = 0;
System.out.println("Enter 1 for Vocabularly exsersises, 2 for Grammer Exercises and 3 for other");
while (input.hasNext()) {
if (input.hasNextInt())
program = input.nextInt() ;
else
System.out.println("Sorry, please choose exercises from above");
}