0% found this document useful (0 votes)
2 views1 page

Java wait() vs notify() Explained

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Java wait() vs notify() Explained

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Difference between wait() and notify() in Java

Feature wait() notify()

Purpose Causes current thread to wait. Wakes up a single waiting thread.

Defined In Object class Object class

Lock Handling Releases the object's lock. Does not release lock immediately.

Synchronization Must be called inside a synchronized block/method.


Same.

Usage Used to pause thread until a condition isUsed


met. to signal that the condition has changed

You might also like