aspose file tools*
The moose likes Threads and Synchronization and the fly likes Why does the wait(), Notify() etc methods lie in the Object class and not thread class?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Why does the wait(), Notify() etc methods lie in the Object class and not thread class??" Watch "Why does the wait(), Notify() etc methods lie in the Object class and not thread class??" New topic
Author

Why does the wait(), Notify() etc methods lie in the Object class and not thread class??

Shivom Shukla
Ranch Hand

Joined: Jul 05, 2012
Posts: 77

A detailed explanation would be appreciated.

Thanks,
Shivom
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

In my opinion, because every Java object has a lock which can be acquired/released so these operations should be of the object's behavior.


PM Me If You Want to get Urgent Help on Java Programming
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41571
    
  54
The FAQ to the rescue: https://www.coderanch.com/how-to/java/WaitAndNotifyInObjectClass


Ping & DNS - my free Android networking tools app
Shivom Shukla
Ranch Hand

Joined: Jul 05, 2012
Posts: 77

Thank you Ulf and Nam,

This is a great Link Ulf.

Regards,
Shivom
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why does the wait(), Notify() etc methods lie in the Object class and not thread class??