接口与继承
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"); } }
运行结果截图