In the given code below class Car inherits class Vehicle. The constructors and info method of class Car use super keyword in various ways. One of the usages of super is incorrect (would not compile) below:
class Vehicle {
// default and parameter constructors
Vehicle() {}
Vehicle(String c) { color = c; }
// info method
void info() {
System.out.println("Color:"+color);
}
protected String color;
}
// Car extends Vehicle
class Car extends Vehicle {
// constructor access super's data member
Car() {
numDoors = 4;
super.color = "Red";
}
// constructor calls super()
Car(String c, int nd) {
numDoors = nd;
super(c);
}
// method calls super's method
void info() {
super.info();
System.out.println("Doors:"+numDoors);
}
private int numDoors;
}
Identify the usage of super in above code that would not compile and select a choice below that correctly describes the wrong usage of super: