aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Thread - join method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Thread - join method" Watch "Thread - join method" New topic

Thread - join method

Cliff DeRose

Joined: Jan 08, 2004
Posts: 13
I have a SCJD exam review book, which tries to explain the join method you can call on a Thread instance. However, its a little confusing to me. Could someone please explain exactly how the join method works when you call it on a Thread instance.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
The Thread.join method will not return to the caller until: 1) the thread join was called on dies, or 2) the specified amount of time elapses.
try the following code, both as is and with the try:join block commented out to see this in action

[ January 12, 2004: Message edited by: Ray Stojonic ]
Cliff DeRose

Joined: Jan 08, 2004
Posts: 13
Thanks so much. It is much easier to understand after seeing it in action.
rocket mass heater kickstarter
subject: Thread - join method