码迷,mamicode.com
首页 > 其他好文 > 详细

Thread中的run()

时间:2019-10-31 23:32:39      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:ted   sep   thread   sub   rate   get   ISE   ble   stop   

      /* 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 }

 

Thread中的run()

标签:ted   sep   thread   sub   rate   get   ISE   ble   stop   

原文地址:https://www.cnblogs.com/xiaofan156/p/11774365.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!