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
What is the purpose of the wait() method?
difference between ejb,struts,hibernate,spring and jsp
Whats new with the stop(), suspend() and resume() methods in jdk 1.2?
What is the purpose of the finally clause of a try-catch-finally statement?
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??
Name three component subclasses that support painting?
What class is used to create Server side object ?
what are getters and setters in Java with examples?
how to use debug in my elipse to solve problems that exist in my project
Can we sent objects using Sockets?
how i secure my site with the https protocol.what are the steps?
What is aop(assepct oriented programing)?
what are memory considerations of jsp compares to other web components?
What is a sessionfactory? Is it a thread-safe object?
Write a program to show synchronization?