public class MainClass { public static void main(String[] argv) { MyClass myObject = new MyClass(); MyAnotherClass myObject2 = new MyAnotherClass(); if (myObject instanceof java.lang.Class) { System.out.println("myobject is an instance of MyAnotherClass"); } } } class MyClass { } class MyAnotherClass extends MyClass { }
Incompatible conditional operand types MyClass and Class