role of scanner class in java code example
Example: role of scanner class in java
The Java Scanner class is widely used to parse text for strings
and primitive types using a regular expression.
It is the simplest way to get input in Java.
By the help of Scanner in Java, we can get input from the user
in primitive types such as int, long, double, byte, float, short, etc.
Scanner in = new Scanner(System.in);