Java

Java Program To Print Integer Using User Input1 min read

Java Code:

Output:




Scanner class reader is used to created to take inputs from standard input, which is keyboard.

reader.nextInt() reads all entered integers from the keyboard unless it encounters a new line character \n (Enter).

If you enter any character which is not an integer, the compiler will throw an InputMismatchException.

Leave a Comment