阿摩線上測驗 登入

試題詳解

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

試卷資訊

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

年份:104年

科目:OJCP(SCJP)

224. Given: 
1. public class Threads4{ 
2. public static void main(String[] args){ 
3. new Threads4.go(); 
4. } 
5. public void go(){ 
6. Runnable r = new Runnable(){
 7. public void run(){ 
8. System.out.print("foo"); 
9. } 
10. }; 
11. Thread t = new Thread(r); 
12. t.start(); 
13. t.start(); 
14. } 
15. } 
What is the result?
(A) Compilation fails.
(B) An exception is thrown at runtime.
(C) The code executes normally and prints "foo";
(D) The code executes normally, but nothing is printed.
正確答案:登入後查看