Scanner
has been used with the standard input stream:
Scanner scan = new Scanner( System.in );
Recall, from chapter 10, that input and output are done with streams of data. There is a standard input stream and a standard output stream.
When a Scanner
object is constructed with System.in
,
it scans the standard input stream of characters for patterns
that the program asks for and (sometimes) converts those characters
to a specific data type.
For example,
the nextInt()
method is used to match characters that
can be converted to an int
.
Could the characters of an input stream come from a disk file?