I/O Streams

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Scanner has been used with the standard input stream:

Scanner scan = new Scanner( System.in );

I/O Streams

Recall, from chapter 10, that input and output are done with streams of data. There is a standard input stream, a standard output stream, and a stardard error stream.

input characters convered to internal numbers

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.

QUESTION 2:

Could the characters of an input stream come from a disk file?