單項(xiàng)選擇題

1. class A implements Runnable ( 
2. int i; 
3. public void run () ( 
4. try ( 
5. thread.sleep(5000); 
6. i= 10; 
7. ) catch(InterruptedException e) {} 
8. ) 
9. ) 
10.   
11. public class Test { 
12. public static void  main (string args[]) (
13. try ( 
14. A a = new A (); 
15. Thread t = new Thread (a); 
16. t.start(); 
17.   
18. int j= a.i; 
19.   
20. ) catch (Exception e) {} 
21. ) 
22. }  
Which statement al line 17 will ensure that j=10 at line 19?()  

A. a.wait();
B. t.wait();
C. t.join();
D. t.yield();
E. t.notify();
F. a.notify();
G. t.interrupt();

微信掃碼免費(fèi)搜題