`

thread 的join

    博客分类:
  • java
阅读更多

java里面也有这个方法,Java Thread中, join() 方法主要是让调用该方法的thread完成run方法里面的东西后, 在执行join()方法后面的代码。

Thread thread = new Thread(new Test()); 
        System.out.println("start...."); 
        thread.start(); 
        thread.join(); 

        System.out.println("after thread runed"); 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics