阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 51-100#99391 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 51-100#99391

年份:104年

科目:OJCP(SCJP)

複選題
89. Given: 
1. public class Car{
 2. private int wheelCount; 
3. private String vin; 
4. public Car(String vin){ 
5. this.vin = vin; 
6. this.wheelCount = 4; 
7. }
 8. public String drive(){
 9. return "zoom-zoom"; 
10. }
 11. public String getInfo(){ 
12. return "VIN: " + vin + "wheels: " + wheelCount; 
13. } 
14. } 
And:
 1. public class MeGo extends Car{
 2. public MeGo(String vin){ 
3. this.wheelCount = 3; 
4. }
 5. }
 What two must the programmer do to correct the compilation errors? (Choose two.)
(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
正確答案:登入後查看