Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


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.

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 tasks
Invoking methods (INVOKE)
Coding interoperable data types in COBOL and Java

related references
VALUE clause (COBOL for Windows Language Reference)
INVOKE statement (COBOL for Windows Language Reference)


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)