62,620
社区成员
发帖
与我相关
我的任务
分享class xt{
public static void main(String in[]){
l lo=new l();
Thread t1=new Thread(lo);
Thread t2=new Thread(lo);
t1.start();
t2.start();
}
}
class l implements Runnable{
Object o1;
public void run(){
synchronized(o1){
for(int i=1; i<4; i++){
try{
Thread.sleep(1000);
}catch(InterruptedException ie){}
System.out.println(Thread.currentThread().getName()+" "+i);
}
}
}
}