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

What is the purpose of the wait() method?

725


difference between  ejb,struts,hibernate,spring and jsp

2421


Whats new with the stop(), suspend() and resume() methods in jdk 1.2?

674


What is the purpose of the finally clause of a try-catch-finally statement?

658


when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??

1199






Name three component subclasses that support painting?

695


What class is used to create Server side object ?

1776


what are getters and setters in Java with examples?

1369


how to use debug in my elipse to solve problems that exist in my project

1854


Can we sent objects using Sockets?

738


how i secure my site with the https protocol.what are the steps?

1824


What is aop(assepct oriented programing)?

662


what are memory considerations of jsp compares to other web components?

6125


What is a sessionfactory? Is it a thread-safe object?

808


Write a program to show synchronization?

774