创造一个多线程;
public class TestThread1 {
public static void main(String args[]){
Runner1 r = new Runner1();
Thread t = new Thread(r);
t.start();//线程进入就绪状态
for (int i=0;i<=100;i++){
System.out.println("main:"+i);
}
}
}
class Runner1 implements Runnable{
public void run(){
for (int i=0;i<=100;i++){
System.out.println("Runner1:"+i);
}
}
}
与main方法交替执行