"Fossies" - the Fresh Open Source Software Archive

Member "jacl1.4.1/docs/TclJava/JavaInstanceOfCmd.html" (27 Dec 2002, 1193 Bytes) of package /linux/misc/old/jacl1.4.1.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. Alternatively you can here view or download the uninterpreted raw source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

The java::instanceof Command


java::instanceof javaObj type

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.


This examples shows using the java::instanceof command to query the inheritance relationship of a java.lang.String object.

% set obj [java::new String mystring]
% java::instanceof $obj Object
Copyright © 1997-1998 Sun Microsystems, Inc.