The join() method waits for a thread to die. In other words, it causes the currently running threads to stop executing until the thread it joins with completes its task.
Syntax:
Example
Test it Now
As you can see in the above example,when t1 completes its task then t2 and t3 starts executing. Following is the program that serves as an example of join(long miliseconds) method.
Test it Now
In the above example,when t1 is completes its task for 1500 miliseconds(3 times) then t2 and t3 starts executing.