public class a implements Runnable {
    static  int b=10;
    public void run() { 
       m1();
   }
 public synchronized void m1(){ 
    b=100;
    try {
        Thread.sleep(100);
    } catch (InterruptedException e) { 
        e.printStackTrace();
    } 
    System.out.println(b);
}
public synchronized void m2(){ 
    try {
        Thread.sleep(100);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    b=200;
    System.out.println(b+"m2");}
public static void main(String[] args) {
    a aa=new a();
    Thread tt=new Thread(aa);
    tt.start();
    aa.m2(); 

}