sum=shuxue+yuwen+yingyu;
}
public String getName()
{
return name;
}
public int getSum()
{
return sum;
}
public int hashCode()
{
return name.hashCode()+sum*78;
}
public boolean equals(Object obj)
{
if (!(obj instanceof Student))
throw new ClassCastException("类型不匹配");
Student s=(Student)obj;
return this.name.equals(s.name)&&this.sum==s.sum;
}
public int compareTo(Student s)
{
int num =new Integer(this.sum).compareTo(new Integer (s.sum));
if(num==0)
return this.name.compareTo(s.name);
return num;
}
public String toString()
{
return "student["+name+","+shuxue+","+yuwen+","+yingyu+"]";
}
}
class StudentInfoTool
{
public static Set<Student>getStudents()throws IOException
{
return getStudents(null);
}
public static Set<Student>getStudents(Comparator<Student> cmp)throws IOException//方法,返回集合
{
BufferedReader bufr=new BufferedReader(new InputStreamReader(System.in));//读取键盘