When should we define fields as "volatile"? When is it unnecessary? : <p>I understand <code>volatile</code> should be used on a class field to prevent the JVM from caching the value so when it will always be the latest value when it's read.</p>

<p>If my understanding is correct, doesn't it mean we should define all fields with <code>volatile</code> when working in a multithread thread-safe environment? When is it unnecessary to define a field as <code>volatile</code>? </p>
