class MyTread implements Runnable{
public void run() {
for (int i=0;i<10;i++) {
System.out.println("线程"+i+Thread.currentThread().getName());
}
}
}
public class Examples01 {
public static void main(String[] args) {
MyThread mt1=new MyThread();
Thread t1=new Thread(mt1); //<-----------这里报错说Thread的构造方法未定义
t1.start();
}
}
遇到奇怪的事情了,求助各位老哥们。昨天写的另一段代码也用了new Thread(mt1),今天执行还没问题,今天再写的这段就报错了。。。
eclipse里说The constructor Thread(MyThread) is undefined