package other;
import java.util.Objects;
public class Student {
private int stuId;
private String name;
private float score;
public Student(int stuId, String name, float score) {
super();
this.stuId = stuId;
this.name = name;
this.score = score;
}
public Student() {
}
public int getStuId() {
return stuId;
}
public void setStuId(int stuId) {
this.stuId = stuId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getScore() {
return score;
}
public void setScore(float score) {
this.score = score;
}
@Override
public String toString(){
return "["+"学号:" + getStuId() + ",姓名:" + getName() + ",成绩:" + getScore() + "]";
}
public int hashCode(){
return Objects.hash(getStuId(),getName());
}
@Override
public boolean equals(Object obj){
if(obj == null){
return false;
}else{
Student stu = (Student) obj;
if(this.getName().equals(stu.getName())&& this.getStuId() == stu.getStuId()) {
return true;
}else{
return false;
}
}
}
}