阅读背景:

Java线程join方法使用

来源:互联网 

话不多说,先上代码。

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



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: