public class jointest { public static void main(String[] v) throws Throwable { Thread t=new Thread() { public void run() { try { Thread.sleep(10000); } catch (Throwable e) { e.printStackTrace(); System.exit(1); } } }; t.start(); t.join(1000); System.out.println("came out of join\n"); } }