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.
public void join()throws InterruptedException
public void join(long milliseconds)throws InterruptedException
Example of join() method
As you can see in the above example,when t1 completes its task then t2 and t3 starts executing.
Example of join(long miliseconds) method
In the above example,when t1 is completes its task for 1500 miliseconds(3 times) then t2 and t3 starts executing.
public String getName()
public void setName(String name)
public long getId()
The currentThread() method returns a reference to the currently executing thread object.
public static Thread currentThread()
Example of currentThread() method