The Scanner class in Java is used for reading input from various sources like keyboard input, files, and streams.
It provides methods such as nextInt(), nextLine(), and nextDouble() to read different types of input.
This class is part of the java.util package, which contains utility classes like collections, date/time libraries, and formatting tools.
To use Scanner, you must import it using: import java.util.Scanner;
- java.applet is used for creating applets.
- java.net is for networking-related classes.
- java.lang contains core classes, but not Scanner.
Therefore, the correct package for Scanner is (A) java.util.