public class MainClass { public static void main(String[] argv){ MyClass myObject = new MyClass(); MyAnotherClass myObject2 = new MyAnotherClass(); if(myObject instanceof "MyClass"){ System.out.println("myobject is an instance of MyAnotherClass"); } } } class MyClass { } class MyAnotherClass extends MyClass { }
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error on token ""MyClass"", invalid ReferenceType at MainClass.main(MainClass.java:6)