2013年8月17日

线程中join()的用法

摘要: Thread中,join()方法的作用是调用线程等待该线程完成后,才能继续用下运行。public static void main(String[] args) throws InterruptedException { System.out.println("main start"); Thread t1 = new Thread(new Worker("thread-1")); t1.start(); t1.join(); System.out.println("main end"); }在上面的例子中,ma... 阅读全文

posted @ 2013-08-17 11:10 LoveEyes 阅读(43989) 评论(1) 推荐(6) 编辑

导航