join() is required when one thread T1 must do its job before thread T2 can complete its work. So in a way we want the threads to work sequentially, one after another. But this can also be done by putting the logic in two different methods and calling them sequentially. Then what is the use of join() ?
Why couldn't the two threads work in parallel? With savings in elapsed time if the underlying system actually allowed parallel processing. There would be no savings in elapsed time if the jobs are done sequentially.
Agree with Norm. Just because the join() method is used, doesn't mean that the operation is sequential -- it could be a parallel operation, that has to meetup at a point, before it can continue the next phase.
The simple example can be - thread T1 does some complex computation and the result is used by thread T2. Unless T1 has completed its job, T2 can not use the computed value. Here T2 can wait for T1 to die. In this scenario use T1.join(). Hope this clarifies.