Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

when to use join method

Sanket.BhaleraoAug 13 2014 — edited Aug 19 2014

Hi,

recently i have been studying Threading, and quite fascinated by it. however i am struggling to understand in what circumstance a programmer will be using a join method on a thread.

what i understand from reading docs is, if i call join() on a thread "thread1", then whenever this call happens the "current thread" will stop its execution till "thread1" finishes its execution i.e. DIE.

when code is executing no one has control over which thread will be the current thread when the join is called.

can someone please explain with a real life scenario?

Thanks in advance

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 16 2014
Added on Aug 13 2014
2 comments
1,233 views