Standard 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   hear noise   go to next page

Answer:

A stream of characters is input (from a file) and later a stream of characters is output (often to the same file).

Standard Streams

Some programs read in the entire input stream before they write the output stream. Other programs read the input stream item by item and produce one item of output for each item of input. There are many other patterns of input and output.

In general, a program may have several input streams flowing into it and several output streams flowing out of it. There are three standard I/O streams:

  • System.in — the input stream.
  • System.out — the output stream for normal results.
  • System.err — the output stream for error messages.

Normally System.in is connected to the keyboard and the data are characters. System.out and System.err both are connected to the monitor, and also contain character data. These notes do not use System.err.

QUESTION 4:

What does the keyboard send to your program when you type the following:

1234