Kb Book THreads Self-test pg-782
And given the following five fragments:
I. new Starter().run();
II. new Starter().start();
III. new
Thread(new Starter());
IV. new Thread(new Starter()).run();
V. new Thread(new Starter()).start();
When the five fragments are inserted, one at a time at line 9, which are true? (Choose all that apply.)
A. All five will compile
B. Only one might produce the output 4 4
C. Only one might produce the output 4 2
D. Exactly two might produce the output 4 4
E. Exactly two might produce the output 4 2
F. Exactly three might produce the output 4 4
G. Exactly three might produce the output 4 2
Ans: C And D
i too think that C is correct but how's D possible.can anyone explain
only III,IV V would work when inserted ,but only V would result in any output.