This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Threads" Watch "Threads" New topic


Ajnam Bujanany

Joined: Jan 27, 2005
Posts: 3
Why notify(),notifyAll() and wait() methods are in Object class and not in Thread Class?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
A quick answer might be that wait() and notify() are used to control behaviour of a particular object, which interacts with more than one thread.

A Thread does, of course, have these methods, as it inherits from Object. However, it is rarely, if ever, useful to use wait() and notify() on a Thread.

Look at some typical examples of how wait() and notify() are used, and then think how you'd implement them if wait() and notify() were methods on Thread not Object. Chances are, it would be harder or impossible to achieve the same functionality.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: Threads
Similar Threads
Doubt about diagram class (realization)
WA #1.....word association
can non-static inner class access any member
andrew has wii
Doubt about diagram class