java的线程

package com.test;


public class Test {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        for(int i=0;i<100;i++){
        ThreadTest tt = new ThreadTest();
        Thread t = new Thread(tt);
        t.start();
        }
    }
    


}


/**
 * 通过实现Runnable接口创建一个线程
 */
 class ThreadTest implements Runnable {
    public void run() {
            System.out.println("I'm running!="+Thread.currentThread().getId());
    }

    
}

 

posted @ 2017-03-29 18:08  甜菜波波  阅读(126)  评论(0编辑  收藏  举报