Why wait, notify, notifyAll these methods are not thread inside the class?

Java provides a lock object level rather than the thread level, each object has a lock obtained by a thread. Simply put, because the wait, notify, notifyAll are lock-level operations, so define them in class because the lock object belonging to the object.

Guess you like

Origin www.cnblogs.com/pzyin/p/11414077.html