This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
in page 505 If you have a reference to a thread t, and its run() method has finished, you can't say t.start(); you'll get a big fat runtime exception. in page 508 If you invoke start() on a dead Thread instance, you'll get a runtime(not compiler) exception. in page 536 You can call start() on a Thread object only once. If start() is called more than once on a Thread object, it will throw a RuntimeException. Now consider the following code:
This program gives a runtime exception but if i remove the comment then it runs fine. When the comment is removed then the new thread must be dead, why should i don't get a runtime exception??? [ April 12, 2004: Message edited by: Barry Gaunt ]
hi, You wont get a runtime exception when u remove the t.join(). Try executing the following example and i am sure u will be clear.
If you run the above example then the following will be the output NameRunnable running Run by Frudo for the ith 0time NameRunnable running Run by Frudo for the ith 1time NameRunnable running Run by Frudo for the ith 2time NameRunnable running Run by Frudo for the ith 3time NameRunnable running Run by Frudo for the ith 4time
and thread name with "Gandalf" will never be executed Regards .PAL. [ April 12, 2004: Message edited by: Barry Gaunt ]
SCJP SCWCD SCBCD <br /> <br />what u do in life echos in eternity!