It's not a secret anymore!
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


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: 502

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
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
The FAQ to the rescue: https://www.coderanch.com/how-to/java/WaitAndNotifyInObjectClass
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??
 
It's not a secret anymore!