It's not a secret anymore!
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
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.
I agree. Here's the link:
subject: join() method
It's not a secret anymore!