Would you be pleased if the air traffic control system halted?

A good answer might be:

No, there might be some problems with that. Even when there is an error, the air traffic control system has to keep running.


BufferedReader

In many real-world programs, the program must keep running no matter what. The program must deal with an exception by fixing the problem or working around it. Java is designed for such programs. Here is the example program again. Look at the first two statements in the main method.

import java.io.*;
class Echo
{
  public static void main (String[] args) throws IOException
  {
    InputStreamReader inStream = 
        new InputStreamReader( System.in ) ;
    BufferedReader stdin = 
        new BufferedReader( inStream );

    String inData;

    System.out.println("Enter the data:");
    inData = stdin.readLine();

    System.out.println("You entered:" + inData );
  }
}

These statements may look somewhat mysterious. It is a bit too early to explain all their details. For now, just think of them as something messy you do to create a BufferedReader object that does input from the keyboard. The object will be called stdin.

You can think of the two statements as a fill-in-the-blank form. Fill in the blank with the name you want for the BufferedReader:

    InputStreamReader inStream = 
        new InputStreamReader( System.in );
    BufferedReader ___________ = 
        new BufferedReader( inStream );

QUESTION 8:

Say that you are writing your own program. Do you have to remember these messy lines?