why the methods wait(), notify(), notifyAll() methods are provided in Object class?
As These methods are related to thread, why they are not specified as members of Thread class?
#1: wait() method is used to take the lock on the object; Every class
extends from Object implicitly. There is nothing like waiting for thread;
Threads wait for object lock to acquire.
#2: You notify the object so that thread scheduler could pick one thread
from the waiting pool to grab the lock of the object just notified.
Note: Every object in
Java has all three methods inherited from the
Object class.
Thanks,
[ June 05, 2007: Message edited by: Chandra Bhatt ]