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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

which type of objects reference will be given to client?

2040


How substring() method of string class create memory leaks?

562


Define aop(assepct oriented programing)?

652


Is it possible to stop the execution of a method before completion in a sessionbean?

611


If your ui seems to freeze periodically, what might be a likely reason?

559






Describe, in general, how java's garbage collector works?

548


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

602


Write a program to show synchronization?

700


Is “abc” a primitive value?

621


what are getters and setters in Java with examples?

1296


What method is invoked to cause an object to begin executing as a separate thread?

582


In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?

2164


Why are my checkboxes not being set from on to off?

652


What is table mutation and how do you avoid it?

1923


Where can I ask questions and make suggestions about seam?

609