看看这些代码:好像没出错,但编译出现这个问题?文件名为Student.java
//继承的运用
package 飞飞小程序;
public class Student {
int stu_id;
void set_id(int id){
stu_id=id;
}
void show_id(){
System.out.println("The student's ID is "+stu_id);
}
}
class UniversityStudent extends Student{
int dep_number;
void set_dep(int dep_num){
dep_number=dep_num;
}
void show_dep(){
System.out.println("The dep_number is:"+dep_number);
}
}
class StudentShow{
public static void main(String[] args){
UniversityStudent zhu=new UniversityStudent();
zhu.set_dep(0500510202);
zhu.set_id(4666189);
zhu.show_id();
zhu.show_dep();
}
}
调试出现:
java.lang.NoSuchMethodError: main
Exception in thread "main"