+ 1
How can I send an error in Java when a user through the Scanner enters a non-numeric symbol in a variable of type int?
please help me, this to avoid an error that closes the program because of the user and thus only have have to repeat a loop (is my homework).
2 ответов
+ 2
You could use try/catch blocks to execute code that will print an error if the user does not type a valid integer in the Scanner. It will not stop the program's execution
https://code.sololearn.com/cMWiXVT9j85Z/?ref=app
+ 1
Thank you