go to previous page   go to home page   go to next page

Answer:

Yes. The stream may come from many sources: keyboard, disk file, String object and others.


I/O Streams

streams entering and leaving a program

The core Java language does not have any I/O methods. For a program to do I/O, it must import an I/O package. These notes (and most programs) use the package java.io.

Data for a program may come from several sources. Data created by a program may be sent to several destinations. The connection between a program and a data source or destination is called a stream.

An input stream handles data flowing into a program. An output stream handles data flowing out of a program.

In the picture, each "O" is a piece of data. The data are streaming from the source into the program. Computed results are streaming from the program to the destination.


QUESTION 2:

Could a disk file be an input stream?


go to previous page   go to home page   go to next page