Java Reference
In-Depth Information
Object: An instance of a class, similar to an instance of the COBOL subrou-
tine's CONTROL area, after the subroutine has been called. You can think of
an object as the result of initializing the subroutine or calling it for the first
time. This result is stored in the subroutine's CONTROL area.
Class data members: The data items that are associated with the subroutine (or
class). Class data members include both the data elements in the subroutine's
LINKAGE SECTION and the data elements in the subroutine's WORKING-
STORAGE. Class data members are also called properties of the class.
Private: Any data elements (or properties) that belong to the class but are not
available outside the class. In COBOL, the items in a subroutine's WORKING-
STORAGE area are private. (This COBOL allegory is not precise; I will clarify
it as I go.)
Public: Any data elements (or properties) that belong to the class but are avail-
able outside the class. They are similar to items in a COBOL subroutine's
LINKAGE SECTION.
The elementary items in MYSUB-CONTROL (e.g., MSG-TEXT and MSG-
SIZE) can be considered data members of the class for the following reasons:
They are data elements that belong to the class definition. This means that they
are only useful as part of the parameter definition for MYSUB. The items in
MYSUB-CONTROL will behave correctly (i.e., MSG-SIZE will be set to 0 or 1)
only after MYSUB is called.
They are unique to each instance of the class. More than one instance of
MYSUB-CONTROL can be defined and passed as a parameter to MYSUB. The
items in any instance of MYSUB-CONTROL will contain information based
on the last time MYSUB was called with that instance of MYSUB-CONTROL.
They can be evaluated and/or set by both the calling program and the subrou-
tine. The data items in the MYSUB-CONTROL define the interface to MYSUB.
This means that a calling program can communicate with MYSUB by using the
data items defined in MYSUB-CONTROL.
O BJECTS AND J AVA
Let's examine what what's been discussed using Java's syntax.
Search WWH ::




Custom Search