Java Reference
In-Depth Information
C LASSES , O BJECTS , AND M EMBERS R EVIEW
This is a good time to review some important concepts:
A Java class is the blueprint, or specification, for all instances of its type.
A Java object is an instance of a class.
A calling program (a class itself) first creates a new object prior to using it.
In the process, the calling program stores a reference to the object in an object in-
stance variable (also known as a reference variable). This reference variable is a
handle , or a pointer, to the object. It contains identifying information about the
object, including information such as the object's storage location (in memory).
The calling program can create many instances of a class and manages each in-
stance by managing the reference variable.
Data members (variables) and methods that are defined by this class are auto-
matically members of this object. They are associated with this instance of the
object and are accessed using the object instance variable as a prefix.
A program can use these object instance (reference) variables to manage more
than one instance of a class. For example:
In this example, myErrorMsg is one object instance variable, and myother-
ErrorMsg is another. They point to different objects of type ErrorMsg .
The object instance variable is used to identify the object that contains the data
members or methods:
 
Search WWH ::




Custom Search