4
Keyboard input using the Scanner Class import java.util.Scanner; /* The package java.util contains the class java.util.Scanner. A package is a collection of classes with a related purpose. The import statement is typed in as the first line of the program before the definition of the class which uses java.util.Scanner. */ Scanner in = new Scanner(System.in); /* new is used to create a new object of type Scanner. The name of the new object is called in to read keyboard input. Note that new is a reserved word, and Scanner on the left acts like a type declaration. System. in identifies the keyboard as the source of input. */ 4