Assume the following code. I don't understand why the output is B's constructor is invoked A's constructor is invoked.
I thought the output was just "A's constructor is invoked", because the construction A(int t) don't invoke the constructor B ?
public class Test {
public static void main(String[] args) {
A a = new A(3);
}
}
class A extends B {
public A(int t) {
System.out.println("A's constructor is invoked");
}
}
class B {
public B() {
System.out.println("B's constructor is invoked");
}
}