阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

年份:104年

科目:OJCP(SCJP)

複選題
235. Given: 
11. public class PingPong implements Runnable{ 
12. synchronized void hit(long n){
 13. for(int i=1; i<3; i++) 
14. System.out.print(n + "-" + i + " "); 
15. }
 16. public static void main(String[] args){
 17. new Thread(new PingPong()).start();
 18. new Thread(new PingPong()).start(); 
19. }
 20. public void run(){ 
21. hit(Thread.currentThread().getId);
 22. } 
23. } 
Which two statements are true? (Choose two.)
(A) The output could be 8-1 7-2 8-2 7-1
(B) The output could be 7-1 7-2 8-1 6-1
(C) The output could be 8-1 7-1 7-2 8-2
(D) The output could be 8-1 8-2 7-1 7-2
正確答案:登入後查看