话不多说,先上代码。
public class TestJoin {
public static void main(String[] args) throws Exception{
ThreadTestJoin t1=new ThreadTestJoin("小王");
ThreadTestJoin t2=new ThreadTestJoin("小明");
t1.start();
t1.join();
t2.start();
}
}
public class ThreadTestJoin extends Thread{
public ThreadTestJoin(String name) {
super(name);
}
@Override
public void run() {
for(int i=0;i<10;i++){
System.out.println(this.getName()+i);
}
}
}public class TestJoin {
public st