“… the volatile modifier guarantees that any thread that reads a field will see the most recently written value.” - Josh Bloch
If you are thinking about using volatile
, read up on the package java.util.concurrent
which deals with atomic behaviour.
The Wikipedia post on a Singleton Pattern shows volatile in use.