Catching an InputMismatchException until it is correct [duplicate]
问题 This question already has answers here : How to handle infinite loop caused by invalid input (InputMismatchException) using Scanner (5 answers) How to use Scanner to accept only valid int as input (6 answers) Closed 2 years ago . I am trying add catch blocks to my program to handle input mismatch exceptions. I set up my first one to work inside of a do while loop, to give the user the opportunity to correct the issue. System.out.print("Enter Customer ID: "); int custID=0; do { try { custID =