阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 1-50#41416 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 1-50#41416

年份:104年

科目:OJCP(SCJP)

第25題 Given: 1. class ClassA{ 2. public int numberOfInstances; 3. protected ClassA(int numberOfInstances){ 4. this.numberOfInstances = numberOfInstances; 5. } 6. } 7. class ExtendedA extends ClassA{ 8. private ExtendedA(int numberOfInstances){ 9. super(numberOfInstances); 10. } 11. public static void main(String[] args){ 12. ExtendedA ext = new ExtendedA(420); 13. System.out.print(ext.numberOfInstances); SCJP 6.0 認證教戰手冊 黃彬華著 碁峰出版 13 14. } 15. } What is the result?
(A) 420 is the output
(B) An exception is thrown at runtime.
(C) All constructors must be declared public.
(D) Constructors CANNOT use the private modifier.
(E) Constructors CANNOT use the protected modifier.
正確答案:登入後查看

詳解 (共 1 筆)

推薦的詳解#2974069
未解鎖
A 子類別直接繼承父類別,沒有做其他事,...
(共 143 字,隱藏中)
前往觀看
10
0