Skip to main content

Explain inter-thread communication.

Junior Java
Quick Answer Inter-thread communication uses wait(), notify(), notifyAll() on a shared object. wait() releases the lock and puts the thread to sleep until notified. notify() wakes one waiting thread. notifyAll() wakes all. Must be called within a synchronized block on the same object. Used for producer-consumer pattern. Modern code uses BlockingQueue instead - much simpler and less error-prone.

Answer

Uses wait(), notify(), notifyAll().
Helps coordinate producer-consumer tasks.
Must be inside synchronized blocks.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice