public class ThreadJoinTest implements Runnable{
	Thread tourist,policeOffice;
	ThreadJoinTest(){
		tourist = new Thread(this);
		tourist.setName("李雷");
	}
	public void run(){
		if(Thread.currentThread()==tourist){
			System.out.println("李雷计划去国外旅游，需要先到警察局办理护照！");
			try{
				Thread.sleep(1000);
				policeOffice = new Thread(this);
				policeOffice.start();
				policeOffice.join();
			}catch(InterruptedException e){
				System.out.println(e);
			}
			System.out.println("李雷拿到了护照，可以去办理签证，准备出国了。");
		}
		else if(Thread.currentThread()==policeOffice){
			try{
				System.out.println("李雷来到警察局正在填写申请表......");
				Thread.sleep(1000);
				System.out.println("李雷在警察局照相......");
				Thread.sleep(1000);
				System.out.println("李雷将申请表和照片交给警察审核......");
				Thread.sleep(1000);
				System.out.println("审核通过，交款，15个工作日后李雷就可以领取护照了！");
				Thread.sleep(2000);
			}catch(InterruptedException e){
				System.out.println(e);
			}
			
		}
	}
}

class TestMain{
	public static void main(String[] args){
		ThreadJoinTest joinTest = new ThreadJoinTest();
		joinTest.tourist.start();
	}
}