title: threads and synchronization example
body: <p>I am new to Java. Below is a code as an example of threads and synchronization.</p>
  
  <pre><code>public class A implements Runnable{
      public synchronized void run(){
  
          /*
          some code here
           */
  
      }
  }
  
  public class B {
      public static void main(String[] args){
          A obj1 = new A();
          Thread t = new Thread(obj1);
          A obj2 = obj1;
          Thread t1 = new Thread(obj2);
          t.start();
          t1.start();
      }
  }
  </code></pre>
  
  <p>Now will this two threads block each other for same lock or will they get two different locks?</p>
  
  <p>Thank you!!</p>