}.start();
new Thread("线程2"){
public void run() {
try {
for(int i=0;i<10;i++){
new Sum().run2();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}.start();
}
}
class Sum {
int i=1;
//public static Object obj=new Object();
Class obj=this.getClass();
int flg=1;
public void run1() throws InterruptedException{
System.out.print("线程1.。。。");
synchronized (obj) {
while(flg!=1){
obj.wait();
}