title: Synchronised instance methods in java
body: <p>From some internet source</p>
  
  <blockquote>
    <p>Here is a synchronized instance method:</p>
  </blockquote>
  
  <pre><code>public synchronized void add(int value){
  
    this.count += value;
  }
  </code></pre>
  
  <blockquote>
    <p>Notice the use of the synchronized keyword in the method declaration. This tells Java that the method is synchronized.
    A synchronized instance method in Java is synchronized on the instance (object) owning the method. Thus, each instance has its synchronized methods synchronized on a different object: the owning instance. Only one thread can execute inside a synchronized instance method. If more than one instance exist, then one thread at a time can execute inside a synchronized instance method per instance. One thread per instance.</p>
  </blockquote>
  
  <p>Here's my understanding. If I have a runnable object, that contains an instance of the class containing the above add method, then</p>
  
  <p>Case 1 : I have two threads, each having the <strong><em>same</em></strong> instance of class containing the add method, then only one will be able to execute the above add method at a time. Hence if one thread calls <code>add</code> then it CAN NOT be pre empted before it finishes the execution?</p>
  
  <p>Case 2 : If both my threads have two <strong><em>different</em></strong> instances of the class containing the add method, then it synchronisation does not really play any role in this case. The two of them will execute, as if synchronisation was not applied at all.</p>
  
  <p>Am I correct in my understanding?</p>