From the JavDoc:
Waits for this thread to die. This implementation uses a loop of this.wait calls conditioned on this.isAlive. As a thread terminates the this.notifyAll method is invoked. It is recommended that applications not use wait, notify, or notifyAll on Thread instances.
Thread t1 = new Thread(new MyRunnable(), "t1");
t1.start();
// wait here for t1 to terminate.
t1.join();
// alternatively, you can provide a timeout in ms.
t1.join(1000);
The calling thread (assume it's the main thread) will wait for another thread, t1
, to terminate.
The term joining might be misleading, there is no joining in that sense of two threads, also no overriding.
If you are trying to terminate a thread, have a look here (in a nutshell, don't try to kill a thread but make it finish it's job, it will terminate naturally after that)