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
Do I have to use jsps with my application?
What is the purpose of the notifyall() method?
Which characters may be used as the second character of an identifier, but not as the first character of an identifier?
What is Remote Server?
which book is better for jdbc ,servlets and jsp
what is the use of State Factories?
how to use debug in my elipse to solve problems that exist in my project
What is abstract schema?
Difference between hashmap and hashtable?
Is the ternary operator written x : y ? Z or x ? Y : z ?
What is threadfactory?
What class is used to create Server side object ?
What is the difference between a static and a non-static inner class?
What is the difference between system.out ,system.err and system.in?
Is “abc” a primitive value?