线程 Thread

public class Demo6{
public static void main(String args[]){
for(int i=0;i<100;i++){
System.out.println("----main----"+i);
}
Thread t1=new Thread(new T1());
t1.start();
}
}

class T1 implements Runnable{
public void run(){
for(int i=0;i<100;i++){
if(i==5){
try{
Thread.sleep(3000);
}catch(Exception e){
}
}
System.out.println("---T1---"+i);
}
}
}

posted @ 2013-03-08 19:00  stt_spring  阅读(142)  评论(0编辑  收藏  举报