Professional Documents
Culture Documents
ESSENTIAL KNOWLEDGE
When a reference variable of a class type is declared, memory space is allocated for the data and
an object of that class type is instantiated. The address of the object is stored in a reference
variable.
From the above diagram, the primitive type variables directly store data into their memory space.
However, the reference variables store the address of the object containing the data.
An object is an instance of a class, and the operator new is used to instantiate an object.
3. Class String
23 7
• -This statement assumes that the value of the variable pay is 565.78
• Closing the file; you close the input and output files by using the method close
inFile.close();
outFile.close();
• Closing the output file ensures that the buffer holding the output will be emptied; that
is, the entire output generated by the program will be sent to the output file
• If an input file does not exist, the program throws a FileNotFoundException
• If an output file cannot be created or accessed, the program throws a
FileNotFoundException
• The method main does not need to handle the FileNotFoundException exception, it
will be included in a command in the heading of the method main to throw the
FileNotFoundException exception