Home > Back-end >  Questions about the Scanner repeat input
Questions about the Scanner repeat input

Time:02-27

 public int testScanner () {
Scanner Scanner=new Scanner (System. In);
While (true) {
Try {
Return scanner. NextInt ();
} the catch (InputMismatchException e) {
e.printStackTrace();
}
}
}


Going to implement a function is to make the user input number, if the input letters catch this exception to re-enter,
But does not enter again but actually the content of the popup exception handling has been...
To solve the
  • Related