Assume we have 2 threads running thread-1 & Thread-2.
If we are applying join on Thread-1, Then Thread-2 wants to wait till completion of Thread-2.
Assume Thread-1 contains some thousands of lines, but Thread-2 wants to wait till completion of 1st 10 lines..
If we use join then the Thread-2 wants to wait till completion of Thread-1. If we use Wait and Notify then there is no need to wait till completion of Thread-1, After completion of 1st 10 lines of Thread-1 the other thread can resume.
public class JoinDrawBack { static int sum=0; public static void main(String a[]) throws InterruptedException { MyThread thread_1=new MyThread(); thread_1.start(); //starting thread_1 thread_1.join(); //applying join on Thread-1 System.out.println(sum); //thread-2 printing the sum //here thread-2 wants to wait till completion of run method, //when we use join then there is no need to wait such a long time. }}class MyThread extends Thread{ public void run(){ for(int i=0;i<10;i++){ JoinDrawBack.sum=JoinDrawBack.sum+i; } ///thousands of lines } }