CHAPTER 11

SIMPLE INPUT/OUTPUT

Modern computers have many input/output (i/o) devices. Any modern programming language should provide methods to work with them. Java is no exception. However, at this stage, we will discuss only conventional devices like keyboard and monitor. We will discuss files in a separate chapter. These days most of the programs use GUI. Input/output techniques for these applications will be discussed later.

At this stage, we will concentrate only on console input/output.

11.1 Concepts of Streams, Stream Classes

From the days of C language, input/output is made stream based. The data is supposed to flow as a stream. Languages support methods to work with these streams.

When data flows from input device to computer (CPU to ...

Get Programming with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.