Object v/s Thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • theneoenderson
    New Member
    • Sep 2006
    • 1

    Object v/s Thread

    could any one tell me that why the 3 overloaded form of wait method and notify, notifyAll are in object class insted of thread class?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by theneoenderson
    could any one tell me that why the 3 overloaded form of wait method and notify, notifyAll are in object class insted of thread class?
    Regarding the wait, from the docs
    "A thread waits on an object's monitor by calling one of the wait methods."
    "This method should only be called by a thread that is the owner of this object's monitor."
    Similar descriptions hold for the other methods.

    These methods therefore have to be in Object since an Object is the monitor for a thread.

    Comment

    Working...