Java Reference
In-Depth Information
4
Class Members
In This Chapter
MYSUB COBOL
MYSUB COBOL: ACTION-SWITCH
Java Variables
Classes, Objects, and Members Review
Objects and COBOL
Using Objects in Java
Java Data Members
Local Variables
Primitive Data Types
Arrays
Method Members
Constructors
Exercises: Class Members
Reviewing the Samples
I'll continue to extend the examples in order to explore other Java concepts.
The principle of data encapsulation is similar to the difference between a subrou-
tine's WORKING-STORAGE and its LINKAGE SECTION.
COBOL specifies that items in a subroutine's WORKING-STORAGE can only
be viewed and modified by the subroutine. Conversely, items in a subroutine's
LINKAGE SECTION are constructed by the caller, then passed into the subroutine.
Therefore, LINKAGE SECTION items are available to both the subroutine and the
caller, and the items in a subroutine's WORKING-STORAGE are not.
Suppose you want MYSUB to count the number of times it has been called. In
this case, you would define a variable in WORKING-STORAGE and increment it
each time MYSUB is called.
65
Search WWH ::




Custom Search