title: Java synchronized keyword - Does it protect a class method from being executed at the same time?
body: <p>I need some clarificaton on how the syncronized keyword works in java 6.</p>
  
  <p>Using the following example class.</p>
  
  <pre><code>class Carrier {
  
     private String[] _collection = new String[2];
  
     public Carrier() {
         this._collection[0] = "abc";
         this._collection[1] = "123";
     }
  
     public syncronized void change(int cId) {
         Thread.sleep(3000);
         this._collection[cId] = "changed";
     }
  
  }
  </code></pre>
  
  <p>Now, some place in the application, referencing the same object instance of the Carrier class, the .change() method is called, possibly at the same time.</p>
  
  <pre><code>...carrier.change(1);
  </code></pre>
  
  <p>...</p>
  
  <pre><code>...carrier.change(1);
  </code></pre>
  
  <p>Will the syncronized keyword prevent asyncronized execution of the method? Will it simply queue the call to .change(), waiting for each one to complete?</p>