package test.joinTest; public class JoinTest { public static void main(String[] args) { try { ThreadA t1=new ThreadA("t1"); t1.start(); t1.join(); System.out.println(Thread.currentThread().getName()+" finish"); } catch (Exception e) { System.out.println(e); } } static class ThreadA extends Thread{ public ThreadA(String name){ super(name); } public void run(){ System.out.println(this.getName()+" start"); for(int i=0;i<1000000;i++); System.out.println(this.getName()+" finish"); } } } t1 start t1 finish main finish