Do you have to remember these messy details?

A good answer might be:

No—use your text editor (Notepad or equivalent) to cut and paste these lines into your own program.


Details (if you want them)

Here are some details of what is going on. Skip this page and the next if you want. Look at the two statements:

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

The first statement declares the variable inStream. It has the form you have seen before:

typeName variableName  =  initialValue ;

Here the typeName is InputStreamReader, a class that is part of the java.io package. You know this is a class, because the type is not one of the eight primitive types. The variable inStream is an object of that data type.

In the first statement, the initialValue will be an object. The new operator constructs an object of the requested type. Once the object is constructed (out of main memory) it can be referred to by the variable inStream. (There will be much more on this later in these notes.)

QUESTION 9:

What (do you suppose) an InputStreamReader object is good for?