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 |
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.