Class.isInstance

Class.isInstance

Class Overview | Class Members | This Package | All Packages

Syntax
public native boolean isInstance( Object obj )
Parameters
obj
The object to check
Description
This method is the dynamic equivalent of the Java language instanceof operator. The method returns true if the specified Object argument is non-null and can be cast to the reference type represented by this Class object without raising a ClassCastException. It returns false otherwise.

Specifically, if this Class object represents a declared class, returns true if the specified Object argument is an instance of the represented class (or of any of its subclasses); false otherwise. If this Class object represents an array class, returns true if the specified Object argument can be converted to an object of the array type by an identity conversion or by a widening reference conversion; false otherwise. If this Class object represents an interface, returns true if the class or any superclass of the specified Object argument implements this interface; false otherwise. If this Class object represents a primitive type, returns false.