首页 新闻 会员 周边 捐助

Java并发练习 - 循环遍历new Thread(new Job()) 与 new Thread(job)有区别吗?

0
悬赏园豆:20 [待解决问题]

public class SemaphoreMain {

public static void main(String[] args) {
PrintQueue queue = new PrintQueue();
Job job = new Job(queue);

Thread thread[] = new Thread[10];
for (int i = 0; i < 10; i++) {

// 运行1或2对程序有什么影响?
//1. thread[i] = new Thread(job, "Thread" + i);
//2. thread[i] = new Thread(new Job(queue));
}

for (int i = 0; i < 10; i++) {
thread[i].start();
}
}
}

zl_说不得的主页 zl_说不得 | 初学一级 | 园豆:33
提问于:2015-03-19 14:27
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册