To create a new Java™ object,
use
ClassName.create(), and assign
the value returned by the
create() method
to a program variable declared with the Java class
name:
IMPORT JAVA java.lang.StringBuffer
MAIN
DEFINE sb StringBuffer
LET sb = StringBuffer.create()
END MAIN
If the Java class constructor
uses parameters, pass the parameters to the
create()
method:
IMPORT JAVA java.lang.StringBuffer
MAIN
DEFINE sb1, sb2 StringBuffer
-- Next code line uses StringBuffer(String str) constructor
LET sb1 = StringBuffer.create("abcdef")
-- Next code line uses StringBuffer(int capacity) constructor
LET sb2 = StringBuffer.create(2048)
END MAIN