阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 201-244#99410 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 201-244#99410

年份:104年

科目:OJCP(SCJP)

222. Given: 
10. public class Starter extends Thread{
 11. private int x = 2; 
12. public static void main(String[] args) throws Exception{ 
13. new Starter().makeItSo(); 
14. } 
15. public Starter(){ 
16. x = 5; 
17. start(); 
18. } 
19. public void makeItSo() throws Exception{ 
20. join(); 
21. x = x - 1; 
22. System.out.println(x); 
23. }
 24. public void run(){x *= 2;} 
25. } 
What is the output if the main() method is run?
(A) 4
(B) 5
(C) 8
(D) 9
(E) Compilation fails.
正確答案:登入後查看