Given:.
2. public class Main extends Thread { 3. public static void main(String[] args) { 4. Thread t = new Thread(new Main()); 5. Thread t2 = new Thread(new Main()); 6. t.start(); /*from ww w .ja v a 2 s .co m*/ 7. t2.start(); 8. } 9. public static void run() { 10. for(int i = 0; i < 2; i++) 11. System.out.print(Thread.currentThread().getName() + " "); 12. } 13. }
Which are true? (Choose all that apply.)
A is correct.
Main does not correctly extend Thread because the run()
method cannot be static.
If run()
was correctly implemented, then D, E, and F would have been correct.
Thread names do NOT have to be sequentially assigned.
C is wrong even if run()
is correct because only two threads are involved.
G is wrong even if run()
is correct, because run()
is called only once per thread.