public class A {
public A() { System.out.print("A "); }
}
public class B extends A {
public B() { System.out.print("B "); }
}
public class C extends B {
public C() { System.out.print("C "); }
}
// Usage:
C c = new C();What is printed?
- A
C
- Bcheck_circle
A B C
- C
C B A
- D
A C
Explanation
Constructors run from the top of the hierarchy down. Implicit super() calls fire first: A runs, then B, then C.