How do I read user input from console using Scanner class?

Share:

In JDK 1.5 a java.util.Scanner class was introduce to handle user input in console application. This class enable us to read string, integer, long, etc in the console application.