这是一道用继承显示专业医生和非专业医生的信息题.
有个问题需要大家指导一下.
运行总是出现这种错误:Exception in thread "main" java.lang.NosuchMethodError:main
代码如下:
class Doctor
{
String name;
int idNumber;
String address;
Doctor(String name1,int id,String addr)
{
name=name1;
idNumber=id;
address=addr;
}
void show()
{
System.out.println("姓名:"+name);
System.out.println("编号:"+idNumber);
System.out.println("地址:"+address);
}
}
class NonSpecialist extends Doctor
{
NonSpecialist(){}
NonSpecialist(String name1,int id,String addr)
{
super(name1,id,addr);
}
void show()
{
super.show();
}
}
class Specialist extends Doctor
{
String zhuanye;
Specialist(){}
Specialist(String name1,int id,String addr,String zy)
{
super(name1,id,addr);
zhuanye=zy;
}
void show()
{
super.show();
System.out.println("专业:");
}
}
class Zhu
{
Zhu(){}
public static void main(String[] args)
{
Specialist s = new Specialist("张三",01,"四川省","医生");
System.out.println("专业医生");
s.show();
NonSpecialist n=new NonSpecialist("李四",02,"广东省");
System.out.println("非专业医生");
n.show();
}
}
请大家帮帮我!
我刚学没多久.
谢谢大家了!