List of expression elements / Data type operators |
The INSTANCEOF checks the class of an object.
expr INSTANCEOF type
The INSTANCEOF operator is used to check if an expression (usually, an object reference) is one of the type or class specified by type.
IMPORT JAVA java.lang.Object IMPORT JAVA java.lang.StringBuffer IMPORT JAVA java.lang.Number MAIN DEFINE o java.lang.Object DEFINE sb java.lang.StringBuffer LET sb = StringBuffer.create() LET o = sb DISPLAY sb INSTANCEOF java.lang.StringBuffer -- shows 1 DISPLAY o INSTANCEOF java.lang.StringBuffer -- shows 1 DISPLAY o INSTANCEOF java.lang.Number -- shows 0 END MAIN