wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "join() method" Watch "join() method" New topic
Author

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.
Corey


SCJP Tipline, etc.
 
jQuery in Action, 2nd edition
 
subject: join() method
 
Similar Threads
how it works---join(),thread class.
Thread once again (Join)
Salient join() characteristics
join()
Join method