Answer the question
In order to leave comments, you need to log in
Doesn't work the second time nextInt. Why?
public static int in_try_int()
{
Scanner in = new Scanner(System.in);
int Input=0;
while(true)
{
try{
Input=in.nextInt();
}
catch (java.util.InputMismatchException error)
{
System.out.println("Некорректный ввод. Повторите.");
continue;
}
break;
}
return Input;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question