Ramesh,
I'm guessing that you're under the impression that the object on which the synchronization is based is always going to be a Thread object, which is why it may seem to you that those methods should have been defined in that class. For example, you've probably seen code like the following:
In this case, the Thread class uses its own monitor for synchronization, which is pretty common practice because of its convenience and simplicitly. However, when you get into a more sophisticated multi-thread application, it's often helpful or necessary to synchronize on a non-Thread object. For example, let's suppose that you've created an instance of ArrayList and you want to write code that will cause one thread to remove an entry from the list or wait until some other thread adds an entry to the list. In that scenario, you could write code like the following:
You'd probably also somewhere have code like the following that would add an entry to the list:
Note that the synchronization (and therefore the wait() and notifyAll() calls) are done using the ArrayList object rather than a Thread instance. If those methods were defined in Thread instead of Object, creating functionality like that shown above would be more difficult.
------------------
Brett Spell
Author,
Professional Java Programming