Scanner Class In Java:
Scanner class is used to collect user input. To create an object of Scanner class first we need to import java.util.Scanner class and we need to pass predefined object System.in.
- To read the values of certain data types, Syntax is: nextDatatype()