Inheritance and the “this” keyword
问题 Suppose that we have next situation: Parent class A: class A{ public A(){} public doSomething(){ System.out.println(this.getClass()); } } with a child class B: class B extends A{ public B(){} public void doSomething(){ super.doSomething(); System.out.println(this.getClass()); } } and Main class: class Main{ public static void main(String[] args){ A ab=new B(); ab.doSomething(); } } When I execute this code result is B B Why does this , referenced in superclass A, returns B as a class when the