Do you have to remember these messy details?
No—use your text editor (Notepad or equivalent) to cut and paste these lines into your own program.
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 ;
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.)