Consider the following program:
class ExtendThread extends Thread { public void run() { System.out.print(Thread.currentThread().getName()); } } public class Main{ public static void main(String []args) throws InterruptedException { Thread thread1 = new Thread(new ExtendThread(), "thread1 "); Thread thread2 = new Thread(thread1, "thread2 "); thread1.start();/*from w w w.ja v a 2 s . c om*/ thread2.start(); thread1.start(); // START } }
Which one of the following correctly describes the behavior of this program?
E.
It is illegal to call the start()
method more than once on a thread; in that case, the thread will throw an IllegalMonitorStateException.