Call Method on Java Object

MATLAB® loads Java® class definitions from files that are on the Java class path.

Use one of the following syntaxes to call method on Java object obj.

  • MATLAB syntax:

    package.class.method(obj,arg1,...,argn) 
  • Java syntax:

    obj.method(arg1,...,argn) 
  • Use the following when the method name exceeds the maximum length of a MATLAB identifier.

    javaMethod(method,obj,arg1,...,argn) 

You do not need to load or import the Java class. Use the MATLAB import function to simplify the Java class name in a command.

See Also

|

More About

Was this topic helpful?