/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Rescore r = new Rescore();
Rescore r1 = new Rescore();
r.flag=1;
r1.flag=0;
Thread t1 = new Thread(r);
Thread t2 = new Thread(r1);
t1.start();
t2.start();
}
}
class Rescore implements Runnable
{
int flag = 1;
Object o1 = new Object() ,o2 = new Object(); //static Object o1 = new Object() ,o2 = new Object(); ,程序死锁,不用static程序可运行结束
public class Rescore implements Runnable {
int flag = 1;
static Object o1 = new Object() ,o2 = new Object(); //static Object o1 = new Object() ,o2 = new Object(); ,程序死锁,不用static程序可运行结束