title: Difference between synchronized methods and blocks
body: <p>My question is seems similar to other question in stack over flow,but I am not able to understand that when have more than one method in the class I put both the methods in synchronized block and I am trying to run the both methods is different threads but here the methods are running one after the other.</p>
  
  <p><strong>Main Class</strong> </p>
  
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package Login.Package;
  
  import java.util.ArrayList;
  import java.util.List;
  import org.hibernate.Session;
  
  /**
   *
   * @author ranjeeth.g
   */
  public class TransportDataTransper {
  
      public static void main(String[] args) {
          Account a = new Account();
          Thread t = new Thread(new WithDraw(a));
          t.start();
          Thread b = new Thread(new BalanceChecfk(a));
          b.start();
  //        Thread t1 = new Thread(new WithDraw(a));
  //        t1.start();
  
  //        t.start();
  //        t.start();
      }
  
  }
  </code></pre>
  
  <p>Account Class.</p>
  
  <pre><code>public class Account {
  
      public double withDr() {
          synchronized (this) {
              System.out.println("with draw check method = ");
              for (int i = 0; i &lt; 50; i++) {
                  System.out.println("i = " + i);
              }
              return 0;
          }
      }
  
      public double balacheck() {
          synchronized (this) {
              System.out.println("Balance check method = ");
              for (int i = 0; i &lt; 50; i++) {
                  System.out.println("i = " + i);
              }
              return 0;
          }
      }
  //    public synchronized double deposit(double amount) {
  //        return 0;
  //    }
  
  }
  </code></pre>