title: What Cases Require Synchronized Method Access in Java?
body: <p>In what cases is it necessary to synchronize access to instance members? 
  I understand that access to static members of a class always needs to be synchronized- because they are shared across all object instances of the class.</p>
  
  <p>My question is when would I be incorrect if I do not synchronize instance members? </p>
  
  <p>for example if my class is</p>
  
  <pre><code>public class MyClass {
      private int instanceVar = 0;
  
      public setInstanceVar()
      {
          instanceVar++;
      }
  
      public getInstanceVar()
      {
          return instanceVar;
      }
  }
  </code></pre>
  
  <p>in what cases (of usage of the class <code>MyClass</code>) would I <em>need</em> to have methods:
  <code>public synchronized setInstanceVar()</code> and
  <code>public synchronized getInstanceVar()</code> ?</p>
  
  <p>Thanks in advance for your answers.</p>