External Interfaces Previous page   Next Page

Determining the Class of an Object

To find the class of a Java object, use the query form of the MATLAB function, class. After execution of the following example, frameClass contains the name of the package and class that Java object frame instantiates.

Because this form of class also works on MATLAB objects, it does not, in itself, tell you whether it is a Java class. To determine the type of class, use the isjava function, which has the form

isjava returns 1 if obj is Java, and 0 if it is not.

To find out whether or not an object is an instance of a specified class, use the isa function, which has the form

isa returns 1 if obj is an instance of the class named 'class_name', and 0 if it is not. Note that 'class_name' can be a MATLAB built-in or user-defined class, as well as a Java class.


Previous page  Accessing Private and Public Data Invoking Methods on Java Objects Next page

© 1994-2005 The MathWorks, Inc.