先建立student类
package day3;
import java.util.Objects;
public class Student {
private String name;
private int chinese;
private int math;
private int English;
public Student() {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Student student = (Student) o;
return chinese == student.chinese &&
math == student.math &&
English == student.English &&
Objects.equals(name, student.name);
}
@Override
public int hashCode() {
return Objects.hash(name, chinese, math, English);
}
@Override
public String toString() {
return "Student{" +
"name='" + name + '\'' +
", chinese=" + chinese +