CONFIGURATION SECTION. REPOSITORY. CLASS JSTRING AS "java.lang.String" CLASS JSYSTEM AS "java.lang.System" . WORKING-STORAGE SECTION. 77 STR1 OBJECT REFERENCE JSTRING. 77 STR2 OBJECT REFERENCE JSTRING. 77 STR3 OBJECT REFERENCE JSTRING. PROCEDURE DIVISION. MAIN. * allocate String object from factory method SET STR1 TO JSYSTEM:>getProperty ( "user.dir" ) * allocate String object by instantiating it SET STR2 TO JSTRING:>new("Some text"). * allocate String object through autoboxing SET STR3 TO "A string". * use the lenght() method of the String objects DISPLAY STR1:>length(). DISPLAY STR2:>length(). DISPLAY STR3:>length(). * deallocate the String ojbects and exit SET STR1 TO NULL. SET STR2 TO NULL. SET STR2 TO NULL. GOBACK. |
CONFIGURATION SECTION. REPOSITORY. CLASS JSTRING AS "java.lang.String" CLASS JSYSTEM AS "java.lang.System" . WORKING-STORAGE SECTION. 77 STR1 OBJECT REFERENCE JSTRING VALUE JSYSTEM:>getProperty ( "user.dir" ). 77 STR2 OBJECT REFERENCE JSTRING VALUE JSTRING:>new("Some text"). 77 STR3 OBJECT REFERENCE JSTRING VALUE "A string". PROCEDURE DIVISION. MAIN. * use the lenght() method of the String objects DISPLAY STR1:>length(). DISPLAY STR2:>length(). DISPLAY STR3:>length(). * deallocate the String ojbects and exit SET STR1 TO NULL. SET STR2 TO NULL. SET STR3 TO NULL. GOBACK. |