这里的super(name)是调用父类Thread的带函数String name的构造方法 ?

class Sleeper extends Thread
{
private int sleeptime;
public Sleeper(String name,int sleepTime){
super(name);
sleeptime=sleepTime;
start();

湖上湖
浏览 177回答 3
3回答

慕工程0101907

这只是调父类的构造函数,并不是 String name的构造方法

动漫人物

有这个方法/*** 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);}

潇湘沐

public Thread(String threadName) {if (threadName == null) {throw new NullPointerException();}create(null, null, threadName, 0); }
打开App,查看更多内容
随时随地看视频慕课网APP