This is a situation where exception comes in handy.
An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled.
An exception can occur for many different reasons. Following are some scenarios where an exception occurs.
A user has entered an invalid data.
A file that needs to be opened cannot be found.
A network connection has been lost in the middle of communications or the JVM has run out of memory.
So in your case surround the code which might cause the error with try block..
when the use will input the wrong type instead of terminating the you can decide what to display on screen.
try{
//code that can produce error i.e. input statement
}catch(Exception e){
System.out.println("Enter Integer");
}