title: java synchronized method - how does it work
body: <p>I think I know this, but would like it confirming.</p>
  
  <p>Obviously the synchronized blocks other threads from accessing it, but I see and awful lot of examples such as</p>
  
  <pre><code>   public synchronized void setValue(int value)
     {
         balance=value;
     }
  </code></pre>
  
  <p>Am I right in thinking, that if the method only does one line like the above, then there is no point in it being synchronized.</p>
  
  <p>Thanks</p>