小凡156

博客园 首页 新随笔 联系 订阅 管理
      /* What will be run. */
      private Runnable target;
如果线程在创建时传入了Runnable运行对象,那么该对象的run方法将被调用
1
/** 2 * If this thread was constructed using a separate 3 * <code>Runnable</code> run object, then that 4 * <code>Runnable</code> object's <code>run</code> method is called;
否则,不做任何事且返回
5 * otherwise, this method does nothing and returns. 6 * <p>
    Thread的子类应该重写这个方法
7 * Subclasses of <code>Thread</code> should override this method. 8 * 9 * @see #start() 10 * @see #stop() 11 * @see #Thread(ThreadGroup, Runnable, String) 12 */ 13 @Override 14 public void run() { 15 if (target != null) { 16 target.run(); 17 } 18 }

 

posted on 2019-10-31 22:42  小凡156  阅读(358)  评论(0编辑  收藏  举报