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 relationship between local interfaces and container-managed relationships?

815


What is a modular application? What does module-relative mean?

742


Can I use javascript to submit a form?

868


What is bean? Where can it be used?

796


What is the purpose of the wait(), notify(), and notifyall() methods?

788


What is the difference between RMI and Corba?

2478


how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.

1966


what are RemoteObjects?

2464


How database connectivity in XML is achieved?

1940


What are the different methods of identifying an object?

774


What are transaction attributes?

824


What is Stream Tokenizer?

1949


int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!

1593


Explain how will the struts know which action class to call when you submit a form?

699


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

6255