Scanner Class
Package: java.util
The Scanner class is designed to read and parse data from an input stream. The input stream can be console input or a file stream connected to a text file.
Constructor
|
Constructor |
Explanation |
|
|
Constructs a |
|
|
Constructs a |
To read data from a command line console, use the constructor as follows:
static Scanner sc = new Scanner(System.in);
Methods
|
Method |
Explanation |
|
|
Returns |
|
|
Returns |
|
|
Returns |
|
|
Returns |
|
|
Returns |
|
|
Returns |
|
|
Returns |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access