Analyze the following code:
public class Test extends A {
public static void main(String[] args) {
Test t = new Test();
t.print();
}
}
class A {
String s;
A(String s) {
this.s = s;
}
public void print() {
System.out.println(s);
}
}
B. The program has an implicit default constructor Test(), but it cannot be compiled, because its super class does not have a default constructor. The program would compile if the constructor in the class A were removed.
C. The program would compile if a default constructor A(){ } is added to class A explicitly.
D. The program compiles, but it has a runtime error due to the conflict on the method name print.
The correct answer is BC
Explanation: See the last Note in the section, "Using the super keyword."