问题:
public class Car {
private int wheelCount;
private String vin;
public Car(String vin) {
this.vin = vin;
this.wheelCount = 4;
}
public String drive() {
return “zoom-zoom”;
}
public String getInfo() {
return “VIN: “+ vin + “wheels: “+ wheelCount;
}
}
And:
public class MeGo extends Car {
public MeGo(String vin) {
this.wheelCount = 3;
}
}
What two must the programmer do to correct the compilation errors?()
A . insert a call to this() in the Car constructor
B . insert a call to this() in the MeGo constructor
C . insert a call to super() in the MeGo constructor
D . insert a call to super(vin) in the MeGo constructor
E . change the wheelCount variable in Car to protected
F . change line 3 in the MeGo class to super.wheelCount = 3;
public class Car {
private int wheelCount;
private String vin;
public Car(String vin) {
this.vin = vin;
this.wheelCount = 4;
}
public String drive() {
return “zoom-zoom”;
}
public String getInfo() {
return “VIN: “+ vin + “wheels: “+ wheelCount;
}
}
And:
public class MeGo extends Car {
public MeGo(String vin) {
this.wheelCount = 3;
}
}
What two must the programmer do to correct the compilation errors?()
● 参考解析
本题暂无解析
相关内容
相关标签