I have a while loop running in order to make sure the user enters proper information. However, it doesn't go through the loop to ask the user again. For example, if I enter "k" when it is looking for an integer, it will not go through any of the program, instead nothing will be output and the program is stuck. I found a question similar to this problem, however the solution offered still does not work. While before my program would skip the while loop and continue, now it is caught doing nothing for eternity.
while (errorLoop) {
try {
if (kb.hasNextInt()) {
Player.setBet(kb.nextInt());
}
}
catch (InputMismatchException e) {
System.out.println("Please enter a positive number.");
}
if (Player.getBet() > 0) {
errorLoop = false;
}
}