请编写一个类,并在测试类中测试它
测试类
测试类
2019-04-25
public class Test {
public static void main(String[] args) {
Student stu1 = new Student("li".90);
Student stu2 = new Student("wang",80)
}
}
//学生类
class Student {
private String name;
private double grade;
//建立一个学生的方法
public Student() {
}
public Student(String name, double grade) {
this.name = name;
this.grade = grade;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getGrade() {
return grade;
}
public void setGrade(double grade) {
this.grade = grade;
}
}
举报