public class Test {
public Test() { } public static void main(String[] args) { new s(); } } class F{ public F() { System.out.println(this.getClass().getName()); this.f1(); } public void f1() { System.out.println(1234); } } class s extends F{ public s() { } public void hello() { System.out.println(123); }}
this指向谁 //运行结果是 s子类
但是又输出1234
解释:https://www.oschina.net/question/74811_123958