Subclass Constructor Super Call
What is the error in the Banana class constructor?
public class Fruit {
public Fruit(String type) { }
}
public class Banana extends Fruit {
public Banana() {
super("yellow", true);
}
}
A
The Banana constructor calls super with two parameters while the Fruit constructor accepts only one parameter.
B
The parameter types in the Fruit constructor are incompatible with those in Banana.
C
The Banana class should not extend Fruit.
D
The Banana constructor should call this() instead of super().
APFIVE