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();