java线程不懂怎么分析
}
程序代码:public class TestThread implements Runnable {
int b= 100;
public synchronized void m1() throws Exception{
b=1000;
Thread.sleep(5000);
System.out.println(b);
}
public void m2() throws Exception {
Thread.sleep(2500);
b=2000;
}
public void run() {
try {
m1();
}catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String [] args) throws Exception{
TestThread tt = new TestThread();
Thread t = new Thread(tt);
t.start();
tt.m2();
System.out.println(tt.b);
}
}
关于怎么分析线程的执行过程不是很清楚~~头疼。。。。有谁能注释一下写清楚上面这个程序的执行过程








