Question:

In which Java package is the scanner class available?

Show Hint

The Scanner class is part of java.util — don’t forget to import it before using.
Updated On: Jul 14, 2025
  • java.util
  • java.applet
  • java.net
  • java.lang
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

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.
Was this answer helpful?
0
0