在Thread类 中覆盖run方法。
但是在 别的方法中调用start 方法就会执行run方法里的代码,
自己查看源码
追到 public synchronized void start() {
/**
* This method is not invoked for the main method thread or "system"
* group threads created/set up by the VM. Any new functionality added
* to this method in the future may have to also be added to the VM.
*
* A zero status value corresponds to state "NEW".
*/
if (threadStatus != 0)
throw new IllegalThreadStateException();
group.add(this);
start0();
if (stopBeforeStart) {
stop0(throwableFromStop);
}
}
private native void start0();
这里找不到原因了 ,估计是start0的原因谁能给解释一下啊
估计是 |