Java Reference
In-Depth Information
Constructor: Constructors are invoked when an object is first created. Con-
structors are similar to methods, but are not considered real methods in Java.
For example, constructors cannot be invoked directly.
Data members of the class: The data items or properties that are associated
with the class. They include all of the data elements that are defined in the
class. These variables are created at the same time each instance of a class is cre-
ated. They normally belong to each instance of a class and are not shared by
unique class instances.
Private: Any data elements (or properties) that belong to the class but are not
available outside the class. Private data elements are identified with the key-
word private . They are similar in this respect to items in a COBOL subrou-
tine's WORKING-STORAGE area, since a calling program cannot directly
access these items.
Public: Any data elements (or properties) that belong to the class but are avail-
able outside the class. Public data elements are identified with the access key-
word public . They are similar in this respect to items in a COBOL subroutine's
LINKAGE SECTION.
Now let's explore another object-oriented design principle and how it relates to
some COBOL concepts.
A calling program contains its objects.
Try to visualize for a moment what happens when a COBOL main program
calls a subroutine. At runtime, and after the subroutine has been called, both the
main program and the subroutine exist in memory. The executing program envi-
ronment (the COBOL run unit) contains both the main program and the subrou-
tine, as depicted in Figure 1.2.
Search WWH ::




Custom Search