public class student{
private int age;
private String name;
private String grade;
public student(){
this(99,"李","2020");
}
public Student(int age,String name,String grade){
this.age = age;
this.name = name;
this.grade = grade;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
}
编译时候提示:java: 方法声明无效; 需要返回类型
报错是在有参构造那一行。我构造名与类名都一致,怎么还会报错?(初学Java)