title: Do I need volatile for variables of reference types, too?
body: <p>We often use <code>volatile</code> to ensure that a condition variable can be visible to every Thread.</p>
  
  <p>I see the <code>volatile</code> fields are all <code>primitive type</code> in code so far.</p>
  
  <p>Does <code>object</code> field has this problem? For example:</p>
  
  <pre><code>class a {
  
     public String str;
  
     public List list;
  
  }
  </code></pre>
  
  <p>If there are some threads which will access str and list, must I add 'volatile'?</p>
  
  <p>I guess each access to <code>Object</code> will get directly from <code>Heap</code>, and the <code>Object</code> will not be cached like primitive type.</p>
  
  <p>Is that right?</p>