模拟并发学习

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

}

}

上一篇:根本没有“JSON“对象这回事(读汤姆大叔博文记录)


下一篇:asp.net DataTable 修改列值