The issue here is that we potentially have a race condition
because one piece of data is being shared between two different threads.
In our first example, the race condition came about because the threads
were accessing multiple pieces of data and there was no way to update
all of them atomically without using the
synchronized keyword. When only a single piece
of data is involved, there is a different solution.
the use scope
Share this highlighthttp://www.safaribooksonline.com/a/java-threads-3rd/19816837/