日期:2014-05-20 浏览次数:20795 次
public class ThreadTest{ public static void main(String[] args){ new ThreadTest().start(); } public void start(){ ThreadNew tn = new ThreadNew(); Thread tn1 = new Thread(tn); Thread tn2 = new Thread(tn); Thread tn3 = new Thread(tn); tn1.start(); tn2.start(); tn3.start(); } } class ThreadNew implements Runnable{ public void run(){ for(int i = 0;i <10000;i++){ System.out.println(" CURRENT:" + Thread.currentThread().getName()); sleep(1000); } } }