join : 当前正在执行的现在中断,等待join 线程执行完才能开始

 

public static void main(String[] args){
		SimpleThread s = new SimpleThread();
          s.start(); try { s.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } for(int i=0;i<1000;i++){ System.out.println("I:"+i); } }

 当前的main 方法必须要等到 SimpleThread s  这个线程执行结束才能开始下面的 循环  SimpleThread 必须是继承 Thread 对象

 

posted on 2017-04-20 11:57  秦水坡  阅读(92)  评论(0编辑  收藏  举报