what is the purpose of a scanner in java code example

Example 1: java scanner

import java.util.Scanner;

// import scanner 

Scanner myScanner = new Scanner(System.in); // Make scanner obj

String inputString = myScanner.nextLine(); // Take whole line

boolean inputBoolean = myScanner.nextBoolean(); //Boolean input

long inputLong = myScanner.nextLong(); //Interger,long ... input

Example 2: scanner java

Scanner sc = new Scanner(System.in);
     int i = sc.nextInt();

Example 3: what does java.util.scanner mean

java.util.scanner

Tags:

Java Example