title: locking behavior of synchronous method
body: <p>A fellow developer is arguing with me that if we call a synchronized method in objectB from another a synchronized method in objectA there is no extra cost to acquire lock on object on objectB because we already have lock on objectA. How do i disprove that? </p>
  
  <p>fellow developers theory - 
  "when you call a synchronized method the thread acquires lock on all objects used in that method."</p>
  
  <pre><code>class ObjectA {
  
  public synchronized void methodA() {
    methodB();
    // do something else
  }
  
  }
  
  class ObjectB {
  
  public synchronized void methodB() {
    // do something
  }
  
  }
  </code></pre>