public class test{
public static void main(String args[])throws Exception{
thre th2=new thre();
thre th3=new thre();
th2.start();
th3.start();
th2.join();
th3.join();
thre th=new thre();
System.out.println(th.n);
}
}
class thre extends Thread{
public static int n=0;
public void run(){
for(int i=0;i<=100;i++){
n++;
}
}
}
重新创建一个线程,为什么他的成员变量的值发生改变,一开始初始化的的值为0! |