线程 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);
}
}
}

原文地址:https://www.cnblogs.com/stting/p/Thread.html