• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why wait/notify in Object class but not in Thread class???  RSS feed

 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
Can any one tell me why the most important methods of Threads are not put in Thread class itself.
Is there any logical explanation behind putting these methods in Object class ???

Thanks
 
Mohamed Sanaulla
Bartender
Posts: 3169
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wait and notify are used in an synchronized context- usually with the locks/object monitors. So they would make sense being part of each object.
 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks mohamed,
Could you please elaborate it .
A real life example will be great.
 
Henry Wong
author
Sheriff
Posts: 22853
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Please do a search for this, as this question comes up often....

http://www.coderanch.com/t/233340/threads/java/Why-java-lang-Object

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!