• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why wait notify notifyall defined in object class

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

why these 3 methods wait() notify() notifyall methods are declared in Object class?

these methods are already implemented in Thread class?


any best answer???



thanks in advance
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
these methods are already implemented in Thread class?

No, they are not implemented in class Thread. Class Thread extends Object and so it inherits the methods from class Object.
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saikrishna cinux:
hi,

why these 3 methods wait() notify() notifyall methods are declared in Object class?

these methods are already implemented in Thread class?


any best answer???



thanks in advance



You did not get the essence of "Object" locking

Go through the API carefully and I hope that should help
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait()
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Srikanth Basavaraju:


You did not get the essence of "Object" locking

Go through the API carefully and I hope that should help
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait()



what do you mean by essence of object locking my dear friend???

any way please tell me why they have imlemented these methods in object class and then overrided in Thread class?

what is the use of implementing these methods in object class only why not in any other class???
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

any way please tell me why they have imlemented these methods in object class and then overrided in Thread class?



It wasn't "overridden" in the Thread class.


what is the use of implementing these methods in object class only why not in any other class???



They implemented in the Object class because they wanted every object to be useable as a notification object. Whether or not you agree that this is a good idea is another issue.

Henry
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aha ! I'm sure you will have to go through the whole story on
Threads
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic