多线程05集的代码,编译正常错误提示
Exception in thread "main" java.lang.NoSuchMethodError: Demo.<init>(Ljava/lang/String;)V
at ThreadDemo.main(ThreadDemo.java:6)
我的源码
class ThreadDemo
{
public static void main(String[] args)
{
System.out.println("def");
Demo d1 = new Demo("旺财");
//Demo d1 = new Demo("jin");
//Demo d2 = new Demo("bao");
//d1.run();
//d2.run();
}
}
class Demo extends Thread
{
private String name;
Demo(String name)
{
this.name = name;
}
public void show()
{
System.out.println(name);
}
public void run()
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 99999;j++ )
{
System.out.println(name + i);
}
}
}
}
我觉得不是我的源码问题,大家有遇到的吗?
|
|