Inter-thread communication in Java

Carvia Tech | July 05, 2019 | | 1 views

Inter-thread communication is all about allowing threads to communicate with each other over a shared mutable object.

Java’s Object class provides 3 final methods which allows inter-thread communication:

  • wait()

  • notify()

  • notifyAll()

All these methods must be used within a synchronized block only.


It instructs the calling thread to give up the lock and go to sleep until some other thread enters the same monitor and calls notify()


It wakes up a single thread that was in waiting state (because that thread called wait()) on the same object. Calling notify() does not actually give up a lock on a resource.


It functionality is quite similar to notify() except that it wakes up all the threads that were on waiting state on the same object.

Top articles in this category:
  1. Top 50 Multi-threading Java Interview Questions for Investment Bank
  2. Citibank Java developer interview questions
  3. Morgan Stanley Java Interview Questions
  4. Sapient Global Market Java Interview Questions and Coding Exercise
  5. BlackRock Top Java Interview Questions: Investment Banking Domain
  6. Top 20 Java Concurrency Interview Questions and Answers
  7. RBS Java Interview Questions

Find more on this topic:
Java Interviews image
Java Interviews

Interview - Product Companies, eCommerce Companies, Investment Banking, Healthcare Industry, Service Companies and Startups.

Last updated 1 month ago

Recommended books for interview preparation:

This website uses cookies to ensure you get the best experience on our website. more info