Why are wait, notify, and notifyAll methods in Object class
Why are wait, notify, and notifyAll methods in Object class instead of Thread class although we use these methods only in a multithreaded application?
Everything has to be able wait, notify, and notifyAll, not just threads. Everything inherits from Object. Magic.
Because you have to specify which lock you're waiting on, notifying, etc., and any object can serve as a lock.
jverda at 2007-7-12 18:01:17 >
