Explain the purposes of methods wait(), notify(), notifyAll
()?

Answers were Sorted based on User's Feedback



Explain the purposes of methods wait(), notify(), notifyAll ()?..

Answer / tek

All the three methods are called in synchronized block or
method.

wait(): Thread calling wait method will go to the waiting
state and it will loose its monitor. It will execute only
if it is notified by the other threads.

notify(): To notify thread which is waiting for the concern
object.

notifyAll(): To notify all the threads which are in waiting
state.

Is This Answer Correct ?    2 Yes 0 No

Explain the purposes of methods wait(), notify(), notifyAll ()?..

Answer / sumitpalsingh

The purpose of using the wait(),notify() and notifyAll() methd is used for interThread communication.
for Example :-There is a n situation communication between Producer and Consumer...Producer wll produce an item and go to waiting state by using wait() method.and it will notify to the consumer for to consume an item. After conume an Item Consumer will come into waiting state by using wait() method ..and give the notification to Produer by using notify() method to produce an item.But all these methods are called only in synhronized() method or synchronized block.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Advanced Java Interview Questions

What is Stream Tokenizer?

0 Answers   TCS,


What are the benefits of detached objects?

0 Answers  


What do you know about seam?

0 Answers  


What is deadlock?

2 Answers  


Why is main purpose of XML?

5 Answers  






What is the difference between a static and a non-static inner class?

0 Answers  


difference. between List and Set?

2 Answers   Campus Interaction, HCL, Infotech,


whats is mean by tiles in struts

2 Answers   SolutionNET,


What is there in browser that it supports web based applications of java or any other PL?

2 Answers  


the same information whether it will connect to the database or it will be used previous information?

0 Answers  


hi, All are saying that now software field position is not good and in 5-10yrs total software field ll be saturated . is it true? i am unable decide ii continue in this field or not please tell me?

19 Answers  


How to do registration form using struts and hibernate?

1 Answers  


Categories