Noob here. I am trying to get a loop going where if an user enter something that is not a number gets an error and can repeat until he gets it right. I somehow end up in an infinte loop with the following code:
public static void console(){
Scanner scanner = new Scanner(System.in);
int input = 1;
int base = 1;
String welcomeMessage = "Enter a positive integer and either base%n";
String choice = "y";
while (!choice.equalsIgnoreCase("n")){
try{
System.out.print("Enter an integer: ");
input = scanner.nextInt();
System.out.println(input);
System.out.print("Enter an base (2, 8, or 16): ");
base = scanner.nextInt();
System.out.println(base);
}catch(InputMismatchException e){
// System.out.println("you suck");
continue;
}
}
}