Invokes an instance method on a Java object from a non-static Java method.
Category: | Method Reference |
Applies to: | Java object |
specifies the name of the Java object.
specifies the result type for the non-static Java method. The type can be one of the following values:
specifies that the result type is BOOLEAN.
specifies that the result type is BYTE.
specifies that the result type is CHAR.
specifies that the result type is DOUBLE.
specifies that the result type is FLOAT.
specifies that the result type is INT.
specifies that the result type is LONG.
specifies that the result type is SHORT.
specifies that the result type is STRING.
specifies that the result type is VOID.
See | Type Issues in SAS Language Reference: Concepts |
specifies the name of the non-static Java method.
Requirement | The method name must be enclosed in either single or double quotation marks. |
specifies the parameters to pass to the method.
specifies the return value if the method returns one.
j
is instantiated, and
then the field values are set and retrieved using the CALLtypeFIELD
method.
/* Java code */ import java.util.*; import java.lang.*; public class ttest { public int i; public double d; public string s; public int im() { return i; } public String sm() { return s; } public double dm() { return d; } }
/* DATA step code */ data _null_; dcl javaobj j("ttest"); length val 8; length str $20; j.setIntField("i", 100); j.setDoubleField("d", 3.14159); j.setStringField("s", "abc"); j.callIntMethod("im", val); put val=; j.callDoubleMethod("dm", val); put val=; j.callStringMethod("sm", str); put str=; run;
val=100 val=3.14159 str=abc