Java Thread Join Example
GIAN Tutorials
7:45 AM
There are three variant of join method: public final void join() throws InterruptedException : Thread on which join method is getting called to die. public final void join(long millis) throws InterruptedException: This method when called on the thread, it waits for either of following: Thread on which join method is getting called, to die. Specified milliseconds public final void join(long millis,int nanos) throws InterruptedException: This method when called on the thread, it waits for either of following: Thread on which join method is getting called, to die. Specified milliseconds + nano seconds Example: Lets take simple example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package org . arpit . java2blog . thread ; public class MyRunnable implements Runnable { public void run ( ) { try { System . out . println ( Thread . currentThread ( ) . getName