多项选择题

Given:
2. public class Cult extends Thread {
3. static int count = 0;
4. public void run() {
5. for(int i = 0; i < 100; i++) {
6. if(i == 5 && count < 3) {
7. Thread t = new Cult(names[count++]);
8. t.start();
9. // insert code here
10. }
11. System.out.print(Thread.currentThread() .getName() + " ");
12. }
13. }
14. public static void main(String[] args) {
15. new Cult ("t0") .start();
16. }
17. Cult(String s) {super(s); }
18. String[] names = {"t1", "t2", "t3"};
19. }
And these two fragments:
Ⅰ. try {t.join(); } catch(Exception e) { }
Ⅱ. try {Thread.currentThread().join(); } catch(Exception e) { }
When each fragment is inserted independently at line 9, which are true (Choose all that apply.)

A.With fragment Ⅰ, t0 completes last.
B.With fragment Ⅰ, t3 completes last.
C.With fragment Ⅱ, t0 completes last.
D.With fragment Ⅱ, t3 completes last.
E.With both fragments, compilation fails.
F.With fragment Ⅰ, the code never completes.
G.With fragment Ⅱ, the code never completes.
题目列表

你可能感兴趣的试题

微信扫码免费搜题