title: Java Thread Synchronization Concept Static Function
body: <p>Recently my friend was asked this question in an Interview.</p>
  
  <p><strong>Question</strong>: We have class A with 2 methods X1 and X2. X1 is static synchronized and X2 is synchronized.</p>
  
  <pre><code>class A {
      public static synchronized X1() {
      }
      public synchronized X2() {
      }
  }
  </code></pre>
  
  <p>Now we know that static synchronized attains the lock on CLASS and synchronized attains the lock on calling object.</p>
  
  <p>Interviewer asked that "what do you mean by lock on CLASS?". The lock is always done on Object. Then what actually happen in case of static synchronized. It attains lock on WHICH OBJECT? </p>
  
  <p>Can someone clear this concept for me as its getting a little confusing out here.</p>