Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 is string data type?

959


How can I become a good programmer?

971


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?

1094


What access modifiers can be used for variables?

1137


How to sort array of 0 and 1 in java?

936


How do weakhashmap works?

1145


Is vector synchronized in java?

984


What classes of exceptions may be caught by a catch clause in java programming?

1169


What are the states of thread in java?

970


What are the differences between c++ and java?

1118


What is java life cycle?

996


What is the purpose of garbage collection in java, and when is it used?

1029


What is thread pool? How can we create thread pool in java?

1054


What are the 3 types of control structures?

1013


Will the compiler creates a default constructor if I have a parameterized constructor in the class?

1097