阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

年份:104年

科目:OJCP(SCJP)

第22題 Given: 1. class Pass{ 2. public static void main(String[] args){ 3. int x = 5; 4. Pass p = new Pass(); 5. p.doStuff(x); 6. System.out.print(" main x = " + x); 7. } 8. void doStuff(int x){ 9. System.out.println(" doStuff x = " + x++); 10. } 11. } What is the result?
(A) Compilation fails.
(B) An exception is thrown at runtime.
(C) doStuff x = 6 main x = 6
(D) doStuff x = 5 main x = 5
(E) doStuff x = 5 main x = 6 F. doStuff x = 6 main x = 5
正確答案:登入後查看

詳解 (共 2 筆)

推薦的詳解#2974034
未解鎖
1.9.的x++ 為"先印出x再+1",...
(共 182 字,隱藏中)
前往觀看
10
0
推薦的詳解#2952349
未解鎖
遞增和遞減擺前面和後面有差別擺前面會先運...
(共 68 字,隱藏中)
前往觀看
0
0