Thejoinmethod allows one thread to wait for the completion of another. Iftis aThreadobject whose thread is currently executing,causes the current thread to pause execution untilt.join();t's thread terminates. Overloads ofjoinallow the programmer to specify a waiting period. However, as withsleep,joinis dependent on the OS for timing, so you should not assume thatjoinwill wait exactly as long as you specify.Like
sleep,joinresponds to an interrupt by exiting with anInterruptedException.