class A{
D d=new D();
A(){
System.out.println("a");
}
}
class B extends A{
C c=new C();
B(){
System.out.println("b");
}
}
class C {
C(){
System.out.println("c");
}
}
class D {
D(){
System.out.println("d");
}
}
public class Test3 {
public static void main(String[] args) {
B b=new B();
}
}
结果:d a c b |