What is wait () in Java?

What is wait () in Java?
Answer
Simply put, wait() is
an instance method that’s used for thread synchronization. It can be called on any object, as it’s defined right on java. lang. Object, but it can only be called from a synchronized block. It releases the lock on the object so that another thread can jump in and acquire a lock.
 

Tìm kiếm

Back
Top