public class Reader extends Thread{
...
public static void run()throws InterruptedException{
Monitor mon = new Monitor();
for(int i = 0; i <10; i++)
{
mon.MonEntry();
Read("file.txt");
mon.MonExit();
}
}
}
由于某种原因,我不能使用扩展线程,因为它说:无法在 Runnable 中实现 run()。我不明白我做错了什么?当我们调用 extends Thread 而不是实现 Runnable 时,我们不应该能够使用我们自己的 run() 实现来启动线程吗?