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
What is string data type?
How can I become a good programmer?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
What access modifiers can be used for variables?
How to sort array of 0 and 1 in java?
How do weakhashmap works?
Is vector synchronized in java?
What classes of exceptions may be caught by a catch clause in java programming?
What are the states of thread in java?
What are the differences between c++ and java?
What is java life cycle?
What is the purpose of garbage collection in java, and when is it used?
What is thread pool? How can we create thread pool in java?
What are the 3 types of control structures?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?