GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 457 of 502    Print  
Why wait and notify method in Object class
Why wait and notify method in Object class, why these are not in Thread Class.


  
Total Answers and Comments: 4 Last Update: November 13, 2009     Asked by: peeyush_m1 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 06, 2008 12:42:41   #1  
rahultiwari8aug Member Since: January 2008   Contribution: 3    

RE: Why wait and notify method in Object class
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.
 
Is this answer useful? Yes | No
February 11, 2008 06:23:19   #2  
sampra Member Since: February 2008   Contribution: 278    

RE: Why wait and notify method in Object class
beacuse these methods are native ie implementd in some other language
 
Is this answer useful? Yes | No
September 16, 2009 10:59:05   #3  
prashant_tambe1 Member Since: September 2009   Contribution: 1    

RE: Why wait and notify method in Object class
Because they provide object locking mechanism.
 
Is this answer useful? Yes | No
November 13, 2009 07:48:42   #4  
sujithkthomas Member Since: November 2009   Contribution: 2    

RE: Why wait and notify method in Object class
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.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape