How can two threads be made to communicate with each other?

Answer Posted / @dania@

Two threads can communicate with each other using
the wait() and notify() , notifyAl() methods. wait()
method tells the thread to wait until another threads
calls notify() method

Is This Answer Correct ?    18 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are meta-annotations?

553


Explain different ways of creating a thread. Which one would you prefer and why?

579


What is the use of volatile in java?

604


What is the locale class in java programming?

531


Why string objects are immutable in java?

569






What is variable declaration and definition?

545


Objects or references which of them gets garbage collected?

538


What is jagged array in java?

535


What about method local inner classes or local inner classes in java?

561


How do you compare two strings lexicographically?

544


How do you escape json?

542


What are the differences between abstract class and interface?

515


Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?

563


what is meant by HQL?

645


What is this () in java?

582