Suppose that we have next situation:
Parent class A:
class A{ public A(){} public doSomething(){ System.out.println(this.getCla
It doesn't matter what the reference is, it's the instantiated object's class that counts. The object that you're creating is of type B, therefore this.getClass() is always going to return B.