Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes join() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "join() method" Watch "join() method" New topic

join() method

Swati Gupta
Ranch Hand

Joined: May 28, 2002
Posts: 106
If we use the join() method with some time argument or the sleep() method with the same time argument in the main thread ,the behaviour of main thread will remain the same?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
No. If you provide a time argument to the join method, that thread will wait for another thread to complete executing or until the time expires, whichever comes first. Assuming the thread is not interrupted, calling Thread.sleep() will cause a thread to stop executing for the number of milliseconds supplied.

SCJP Tipline, etc.
Have you tried LearnNowOnline?
subject: join() method