public class TT implements Runnable{
int b = 100;

public  synchronized void m1(){
b = 1000;
try {
Thread.sleep(2500);
} catch (InterruptedException e) {

e.printStackTrace();
}
System.out.println("b = "+b);

}

public synchronized void m2(){
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
b=2000;
//System.out.println("123456");
}
public static void main(String[] args){
TT tt = new TT ();
Thread t = new Thread (tt);
t.start();

tt.m2();

System.out.println(tt.b);


}
public void run() {
m1();

}
}
m2方法里面注释掉一个输出,如果把注释取消输出结果不相同
不注释的结果:123456
2000
b = 1000注释的结果:1000
b = 1000希望有高手详细解释