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;
}