首页 > 其他 > 详细

Thread()

时间:2019-10-30 14:20:26      阅读:67      评论:0      收藏:0      [点我收藏+]
 1     默认构造方法 分配一个新的线程对象
 2     这个构造器和上面的#Thread(ThreadGroup,Runnable,String)方法有相同作用,其中线程名是新生成的名称
 3     自动生成名称的格式为Thread-n,其中n是一个整数
 4     /**
 5      * Allocates a new {@code Thread} object. This constructor has the same
 6      * effect as {@linkplain #Thread(ThreadGroup,Runnable,String) Thread}
 7      * {@code (null, null, gname)}, where {@code gname} is a newly generated
 8      * name. Automatically generated names are of the form
 9      * {@code "Thread-"+}<i>n</i>, where <i>n</i> is an integer.
10      */
11     public Thread() {
12         init(null, null, "Thread-" + nextThreadNum(), 0);
13     }
          测试代码 输出空
1
Thread name = new Thread(); 2 name.run();

 

Thread()

原文:https://www.cnblogs.com/xiaofan156/p/11764186.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!