External Interfaces/API    

Invoking Static Methods on Java Classes

To invoke a static method on a Java class, use the Java invocation syntax

For example, call the isNaN static method on the java.lang.Double class.

Alternatively, you can apply static method names to instances of a class. In this example, the isNaN static method is referenced in relation to the dblObject instance of the java.lang.Double class.

Several of the programming examples in this chapter contain examples of static method invocation. For example, the code for Communicating Through a Serial Port contains a call to static method getPortIdentifier on Java class javax.comm.CommPortIdentifier.

Using the javaMethod Function on Static Methods

The javaMethod function was introduced in section Using the javaMethod Function on Nonstatic Methods. You can also use this function to call static methods.

The following syntax invokes the static method, method_name, in class, class_name, with the argument list that matches x1,...,xn. This returns the value X.

For example, to call the static isNaN method of the java.lang.Double class on a double value of 2.2, you use

Using the javaMethod function to call static methods enables you to:


  Invoking Methods on Java Objects Obtaining Information About Methods