How two different class threads communicate with each
other?. send example code.

Answer Posted / puneet khanna

The threads in java follow Mutual exclusion( synchronized)
and co-operation;

for co-operation they need to talk to each other by messages
saying " i am waiting in the wait q anyone can acquire the
lock of the object" or" i have acquired the lock now by
notify() to the last thread who called wait() or by
notifyall() to all the threads who are in the wait q"

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between runnable and callable interface in java?

851


Garbage collection in java?

813


Is map sorted in java?

845


What are methods and how are they defined?

914


Explain about join() method?

764


If we don’t want some of the fields not to serialize how to do that?

820


what is ststic with example

1822


How many inner classes can a class have?

846


What is difference between printf and scanf?

774


What is anonymous inner class?

852


Explain aggregation in java?

768


Is 0 an irrational number?

846


What is a type parameter in java?

792


Why Java doesn’t support multiple inheritance?

848


if u open login & logout ,how can udisplay the timelogin & logout members ?

1991