Advanced Java Tutorial

Total available pages count: 55
Subject - Java Technologies

Inter thread communication

Inter thread communication is all about allowing the synchronized thread to communicate with one another.

Inter thread communication is a method in which thread is paused running in the critical section & another thread is allowed to enter or lock in the same section to be executed.

Inter thread communication is implemented by the following method of object class:

  • wait()
  • notify()
  • notifyAll()


wait() method, recent thread to release the lock & wait until another thread invoke the notify() or notifyAll() for those object.

public final void wait() throws InterruptedException
	// waits until object is notified.

public final void wait(long timeout) throws InterruptedException
	//waits for the specified amount of time



notify() method get to wake up a single thread that is waiting on object lock. If a thread is waiting on this object, one of them is chosen to be alive.

public final void notify()



notifyAll() method get to wake up all the thread that is in waiting on the object’s monitor.

public final void notifyAll()


wait(), notify() & notifyAll() methods are described in object class because it is related to lock & object has lock.