在下面给出的代码中,我Temp在构造函数调用中传递了类对象的引用 ID,Thread这将被线程类的构造函数在Runnable类型引用变量中捕获。所以我想问一下,在Thread该类构造函数中是否有任何代码告诉JVM,这个特定类的run()方法将在创建线程时执行。
class Temp implements Runnable
{
public void run()
{
System.out.println("Hello from a thread!");
}
public static void main(String args[])
{
(new Thread(new Temp())).start();
}
}