revised: 9/26/98; 7/30/99; 01/17/00; 06/01/00

CHAPTER 10 --- Input and Output

To be useful, a program must input data and output the results of processing that data. This chapter discusses some easy ways to input and output data from the keyboard and monitor. Input and output operations are a very complicated aspect of computers (and computer programming languages), so this chapter is just a beginning.

Chapter Topics:

  • Input and Output Streams.
  • The standard IO streams.
  • Exceptions
  • InputStreamReader and BufferedReader Classes.
  • Converting character data to type int.

Note: if you are reading a Java text book and are also following these notes you may find that your text book uses its own methods for doing input from the keyboard. This is OK, You can still use these notes. The methods used in these notes are part of the JDK (Java Development Kit) and will work for every Java installation. The methods in your book are (probably) unique to that book and require you to use a special package written by its author. Those methods are based on the methods in the JDK, so you won't be doing anything radically different.

QUESTION 1:

When a computer program does an input operation, in which direction does the data flow?

  • From an outside device into the program?
  • From the program out to some device?

Click Here after you have answered the question