下面程序有两个错误,但刚学java,不太了解有参和无参构造方法,哪位大神能帮忙指点一下
class Student{private String name;
private int grade;
public String getName(){
return name;
}
public void setName(String name1){
name=name1;
}
public int getGrade(){
return grade;
}
public void setGrade(int grade1){
if(grade1<0){
System.out.println("成绩错误");
}else{
grade=grade1;
}
}
public Student(String name,int grade){
this.name=name;
this.grade=grade;
}
public class xinxin {
public static void main(String[] args) {
Student stu1=new Student();
stu1.setName("张三");
stu1.setGrade(100);
Student stu2=new Student("李四",59);
}
}
}