Instantiating Java classes

To instantiate a Java™ class, invoke any parameterized constructor that the class supports by coding the USING phrase in the INVOKE . . . NEW statement immediately before the RETURNING phrase, passing BY VALUE the number and types of arguments that match the signature of the constructor.

About this task

The data type of each argument must be one of the types that are interoperable with Java. To invoke the default (parameterless) constructor, omit the USING phrase.

For example, to create an instance of the Check class, initialize its instance data, and obtain reference aCheck to the Check instance created, you could code this statement in a COBOL client:


Invoke Check New
  using by value aCheckingAccount, payee, 125
  returning aCheck

Related references  
VALUE clause (Enterprise COBOL for z/OS® Language Reference)  
INVOKE statement (Enterprise COBOL for z/OS Language Reference)