class Sleeper extends Thread{private int sleeptime;public Sleeper(String name,int sleepTime){super(name);sleeptime=sleepTime;start();
3 回答
动漫人物
TA贡献1815条经验 获得超10个赞
有这个方法
/**
* Allocates a new <code>Thread</code> object. This constructor has
* the same effect as <code>Thread(null, null, name)</code>.
*
* @param name the name of the new thread.
* @see #Thread(ThreadGroup, Runnable, String)
*/
public Thread(String name) {
init(null, null, name, 0);
}
潇湘沐
TA贡献1816条经验 获得超6个赞
public Thread(String threadName) {
if (threadName == null) {
throw new NullPointerException();
}
create(null, null, threadName, 0); }
添加回答
举报
0/150
提交
取消