title: Is there a difference between making a method synchronized or adding a synchronized block into the method?
body: <p>Will these two code blocks behave equally? You may assume that those run methods are called from threads.</p>
  
  <pre><code>public synchronized void run() {
      System.out.println("A thread is running.");
  }
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>static Object syncObject = new Object();
  
  public void run() {
      synchronized(syncObject) {
          System.out.println("A thread is running.");
      }
  }
  </code></pre>