• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Shivom Shukla
Ranch Hand
Posts: 77
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A detailed explanation would be appreciated.

Thanks,
Shivom
 
Nam Ha Minh
Ranch Hand
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FAQ to the rescue: https://www.coderanch.com/how-to/java/WaitAndNotifyInObjectClass
 
Shivom Shukla
Ranch Hand
Posts: 77
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ulf and Nam,

This is a great Link Ulf.

Regards,
Shivom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic