Import the scanner class from the java.util package:
Import java.util.Scanner;
Put this line in before anything else

Another thing needed (Initializing scanner):
Scanner input = new Scanner(;
Input: Variable name
Scanner: Data type
New Scanner: Creates a new Scanner object The argument, or Actual parameter
Usually, a value that corresponds with keyboard data, and is from the same package as System.out.print

Before entering any new data we need to clear the buffer, which can be done, by simply having the line:

How to input with each data type:
String: input.nextLine();
Integer: input.nextInt();
Double: input.nextDouble();

No Responses

Speak your mind