I want to compare the class type in Java.
I thought I could do this:
class MyObject_1 {}
class MyObject_2 extends MyObject_1 {}
public boolean funct
If you don't want to or can't use instanceof, then compare with equals:
if(obj.getClass().equals(MyObject.class)) System.out.println("true");
BTW - it's strange because the two Class instances in your statement really should be the same, at least in your example code. They may be different if: