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

What are different types of expressions?

762


Which are different kinds of source code?

893


What is the purpose of a transient variable?

822


What is a file pointer?

724


Define interface in java?

825


What is collections framework?

857


How are the elements of a gridbaglayout organized?

800


What does the append?

727


Convert Binary tree to linked list.

841


What are the fileinputstream and fileoutputstream?

853


How many threads can I run java?

804


How many digits can a float hold?

769


How do you initialize an arraylist in java?

752


how to create multithreaded program? Explain different ways of using thread? : Java thread

752


What is use of static in java?

814