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.
Please note that this code is not 'starting' new threads as it might appear to be. To start a thread you need to issue: obj.start() but this code is saying: obj.run() Therefore run() method is called as regular method. No new thread is created. After first run() call is returned, second is run() is executed. Hope this makes sense. Barkat
Joined: Jul 21, 2003
i totally agree that there is no threads being started, however i am a bit confused about sleep followed by yields. can you please clarify?
Joined: Aug 05, 2002
Each call for run() will sleep for a second and then attempt to yield. But as you said there is not other thread to yield to, same thread (main) will continue. Hope this makes sense. Barkat