File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Doubt regarding wait(), notify() and notifyAll() methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt regarding wait(), notify() and notifyAll() methods" Watch "Doubt regarding wait(), notify() and notifyAll() methods" New topic
Author

Doubt regarding wait(), notify() and notifyAll() methods

Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Hi All
Please tell me one thing. If the methods wait(), notify() and notifyAll() are used in context of mulithreading, then why are these methods of java.lang.Object class and not java.lang.Thread class?

Regards
Mansukhdeep


~ Mansukh
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
This is a very good question; so good that it has been asked many many times. A simple search of this forum will likely bring you many decent replies to similar questions. For instance this one: Why-java-lang-Object

Much luck!
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

because before calling any of these method we have to synchronized it with a object.

we have to occupy a lock on a object monitor


SCJP6.0,My blog Ranchers from Delhi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt regarding wait(), notify() and notifyAll() methods