Why wait and notify method in Object class

Why wait and notify method in Object class, why these are not in Thread Class.

Questions by peeyush_m1

Showing Answers 1 - 12 of 12 Answers

wait and notify are in object class because we use them for communication between thread and objects.if wait() is called on thread,that thread has to release object it holds.these facility is not provided to Thread class methods  liek sleep() or suspend() which does not release objects.                                      

  Was this answer useful?  Yes

Inter thread communication is not directly supported by the producer or consumer, but by the object they are acting upon. Also lock is associated with a particular object. If a thread needs a lock it use sync block and release using object's methods.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions