Main Content

Determine Class of Java Object

To find the class of a Java® object, use the class function. For example:

value = java.lang.Integer(0);
myClass = class(value)
myClass = java.lang.Integer

The class function does not tell you whether the class is a Java class. For this information, call the isjava function. For example, the class value is a Java class:

ans = 

To find out if an object is an instance of a specific class, call the isa function. The class can be a MATLAB® built-in, a user-defined class, or a Java class. For example:

ans = 

See Also

| |