java中父类构造方法中的this指向谁

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

posted @ 2018-05-12 16:50  随风残虹  阅读(267)  评论(0编辑  收藏  举报