- 论坛徽章:
- 0
|
代码如下:
public class MultiThread {
public static void main(String[] args) {
MyThread mt=new MyThread(); //该行报错
new Thread(mt,"firstThread").start();
//firstThread.start();
}
}
class MyThread implements Runnable{
/* (非 Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
// TODO 自动生成方法存根
while(true){
System.out.println("Thread name:"+Thread.currentThread().getName());
}
}
}
错误提示:
java.lang.NoSuchMethodError: MyThread: method <init>()V not found
at MultiThread.main(MultiThread.java:5)
Exception in thread "main"
难道不能这么实例化,请各位指教一下? |
|