62,614
社区成员
发帖
与我相关
我的任务
分享
class MultiDownloadThread implements Runnable{
private int index;
public void run() {
// TODO Auto-generated method stub
synchronized (this) {
index++;
download(index);//这个方法,里面会有堵塞,
}
}
class Demo{
public static void main(String []args){
MultiDownloadThread t=new MultiDownloadThread();
new Thread(t).start();
new Thread(t).start();
}
}