File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Sharing variable between two threads. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic

Sharing variable between two threads.

Joseph Cho
Ranch Hand

Joined: Feb 19, 2012
Posts: 44
I'm trying to have one thread keep track of the time while the main thread does the work.. For some reason the thread is not getting the updated variable, how do I get this to work? I tried using a static variable but it's not working..

Here is the code:

Rakesh K. Cherukuri
Ranch Hand

Joined: Jun 01, 2010
Posts: 48

Duplicate of

The other one already has responses

Warm Regards,
I agree. Here's the link:
subject: Sharing variable between two threads.
jQuery in Action, 3rd edition