i have this piece of code. I wanted to return to the beginning of loop and ask for user input again. However, it always loops without stopping to ask for input. What is wron
Put a line separator in your catch block.
catch
Scanner input = new Scanner(System.in); while(true) { try { int choice = input.nextInt(); } catch (InputMismatchException e) { input.next(); // Line separator } }