The java::instanceof command is used to determine if a Java object is of a given type. The javaObj argument specifies an object handle. The type argument specifies an interface or class name. If the type argument is a class name, java::instanceof will return 1 if the javaObj argument is an instance of type or an instance of a subclass of type. If the type argument is an interface name, java::instanceof returns 1 if the javaObj argument implements the interface. Otherwise, java::instanceof returns 0.
% set obj [java::new String mystring]
% java::instanceof $obj Object
1
Copyright © 1997-1998 Sun Microsystems, Inc.