Types of Sources and Destinations

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:

Yes. One program can be the source of the stream and the other program can be the destination.

Types of Sources and Destinations

A stream that connects two executing programs is called a pipe. To one program the pipe is an output stream; to the other program it is an input stream.

There are many types of IO devices. Some can be a source, others can be a destination, and others can be both source and destination. Often the destination for one stream is the source for another. In the table, decide what role each object can play.

Object Source? Destination? or Both?
disk file
running program
monitor
keyboard
Internet connection
image scanner

Some objects switch roles depending on what program is running. For example a disk file might be the destination for the output of one program, and later it may be the source for another program.

QUESTION 3:

Do you think it is possible for a program to use several input and several output streams?