lihuidu
public static void main(String[] args) {	
for(Thread t:getThreads()){
t.start();
}
}

public static Thread[] getThreads(){
Thread[] thread = new Thread[10];
for(int i=0;i<10;i++){
final Integer num = new Integer(i);
thread[i] = new Thread(new Runnable(){
public void run() {
int j=5;
while(j-->0){
System.out.println("this is thread"+num);
}
}
});
}
return thread;
}

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2021-12-06
  • 2022-02-09
  • 2021-11-21
  • 2021-11-28
  • 2021-11-29
  • 2021-09-10
猜你喜欢
  • 2021-12-06
  • 2021-05-11
  • 2021-05-10
  • 2021-06-11
相关资源
相似解决方案