package com.mem.server;
import java.util.concurrent.CountDownLatch;
public class ThreadForBing {
private static final int count=10;
private static CountDownLatch col=new CountDownLatch(count);
public static void main(String[] args) {
for (int i = 0; i <count ; i++) {
new Thread(new Runnable() {
public void run() {
try {
col.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("当前"+Thread.currentThread().getName());
}
}).start();
col.countDown();
}
}
}