class A{
public A(){
System.out.println("in A");
}
}
public class SampleClass{
public static void main(String[] args) {
A a = new A();
System.out.println(A.class.isInstance(a.getClass()));
}
}
Output:
false
Why is it false? Both A.class
and a.getClass()
should not return the same class!
And in which condition we will get true from the isInstance()
method?