sleep method causes the currently running thread to stop executing for specified duration.
Example, Thread.sleep(1000) would sleep the current thread for 1000 milliseconds.
yield() will typically make the currently running thread runnable so that another thread can get their turn.
However, there is no guarantee of it.
The thread scheduler may again choose the yielding thread.
join() method causes one thread to join at the end of another thread.
If you have a thread t2 that shouldn’t’ run until thread t1 is over, then join t2 to t1.
t1.join(); // joins currently running thread to end of thread t1
© 2015, www.topjavatutorial.com. All rights reserved. On republishing this post, you must provide link to original post