阿摩線上測驗 登入

申論題資訊

試卷:104年 - SCJP 201-244#99410
科目:OJCP(SCJP)
年份:104年
排序:0

申論題內容

225. Given: 
10. Runnable r = new Runnable(){
 11. public void run(){ 
12. try{ 
13. Thread.sleep(1000); 
14. }catch(InterruptedException e){ 
15. System.out.println("interrupted"); 
16. } 
17. System.out.println("ran"); 
18. } 
19. }; 
20. Thread t = new Thread(r); 
21. t.start(); 
22. System.out.println("started"); 
23. t.sleep(2000): 
24. System.out.println("interrupting"); 
25. t.interrupt(); 
26. System.out.println("ended"); 
Assume that sleep(n) executes in exactly n milliseconds. and all other code executes in an insignificant amount of time.
 Place the fragments in the output area to show the result of running this code. 60d00fa0a1375.jpg