wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes wait() and notify() methods ragarding threads. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "wait() and notify() methods ragarding threads." Watch "wait() and notify() methods ragarding threads." New topic

wait() and notify() methods ragarding threads.

dolly bhawsar

Joined: Feb 19, 2010
Posts: 3
i want to know how should i implement, if i have two threads waiting on a bunch of code to be complete.

just for an simple example: if i have write a function to calculate sum of few integers and after performing this sum i m displaying that amount.
finally i want that one thread perform this sum() and another print it,,so i want that while executing the sum() through one thread another would wait for it's completion.

please someone tell me the code for implementing above, so that i can clearly understand the basic idea of wait and notify. i m confused in terms of when to wait, for which object i have to use wait(), and when and for which thread i have to use notify().

Dolly Bhawsar
sushil grover

Joined: Nov 28, 2008
Posts: 12
you can refer to the post given below:-


I agree. Here's the link: http://aspose.com/file-tools
subject: wait() and notify() methods ragarding threads.