阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

年份:104年

科目:OJCP(SCJP)

第39題 Given: 11. public class ItemTest{ 12. private final int id; 13. public ItemTest(int id){this.id = id;} 14. public void updateId(int newId){id = newId;} 15. 16. public static void main(String[] args){ 17. ItemTest fa = new ItemTest(42); 18. fa.updateId(69); 19. System.out.println(fa.id); 20. } 21. } Which four statments are true? (Choose four.)
(A) Compilation fails.
(B) An exception is thrown at runtime.
(C) The attribute id in the ItemTest object remains unchanged.
(D) The attribute id in the ItemTest object is modified to the new value.
(E) A new ItemTest object is created with the preferred value in the id attribute.
正確答案:登入後查看

詳解 (共 2 筆)

推薦的詳解#7186153
未解鎖
這是一道關於 Java 關鍵字 fina...
(共 2207 字,隱藏中)
前往觀看
0
0
推薦的詳解#2463218
未解鎖
id為常數 初始化之後就不能再變更值了
(共 21 字,隱藏中)
前往觀看
0
0