接口与继承

 

public class TestInherit {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Child c=new Child();
    }

}
class Grandparent
{
    public Grandparent()
    {
        System.out.println("Grandparent created");
    }
    public Grandparent(String string)
    {
        System.out.println("Grandparent creat string"+string);    
    }
}
class Parent extends Grandparent
{
    public Parent()
    {
        super("123");
        System.out.println("Parent created");
        
    }
    
}
class Child extends Parent
{
    public Child()
    {
        System.out.println("Child created");
    }
}

运行结果截图

 

posted @ 2016-11-11 10:36  Steerner  阅读(105)  评论(0编辑  收藏  举报