This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, The code looks good, but just one thing that poped into my mind... What if t2 never gets chance to run before t1, meaning there won't be actual join... ? or what if t1 will never get chance to run....and t1 goes ahead and finishes.... I might not sure but how about this code ...
Just that t2 starts t1 and joins itself... Thanks Venkatesh
SCJP 1.4, SCWCD<p>Ours is a world where people don't know what they want and are willing to go through hell to get it.<br /> - Don Marquis
Joined: Aug 25, 2003
If a call to the thread's isAlive() method returns false, you can still join a currently executing thread to it. isAlive() returns false if a thread hasn't been started or its run() has completed. In this event, t.join() returns immediately to allow the current thread to continue executing. [ December 24, 2003: Message edited by: Vad Fogel ]