//The left argument can be object reference, usually a variable or an array element.
//The right operand must be a class, interface, or array type.
public class MainClass {
public static void main(String[] argv) {
MyClass myObject = new MyClass();
if (myObject instanceof MyClass) {
System.out.println("myobject is an instance of MyObject");
}
}
}
class MyClass {
}
class MyAnotherClass {
}
|