Can you give an example of how the "volatile" keyword might be used?

John Mitchell

Alas, the only truly useful answer is "don't use it". :-( At least, don't rely on it for anything...

Basically, the language and VM specifications don't really make it clear/precise/etc. what should/shouldn't really be done in the presence of volatile and so many implementations of the JVM don't do anything if volatile is specified. Note that there are some folks actively working to solve this in time for the next release.