为了账号安全,请及时绑定邮箱和手机立即绑定

java集合的问题

java集合的问题

慕先生4463397 2017-10-16 16:53:48
/** * @author 墨风 */public class Student implements Comparable{ //名字 String name; //分数 int score; int age; public Student(String name,int score){ this.name = name; this.score = score; } public String toString(){ return name+"得了"+score+"分"; } public boolean equals(Object o){ if(this==o){ return true; } if(o instanceof Student){ Student stu = (Student) o; if(stu.name.equals(this.name)&&(stu.score==this.score)){ return true; } } return false; } public int hashCode(){ return score/10; }23行的this指的是
查看完整描述

2 回答

已采纳
?
窗下有梧桐

TA贡献5条经验 获得超3个赞

this指的是当前对象,比如你调用a.equals(b),那么this指的就是a对象,望采纳。

查看完整回答
1 反对 回复 2017-10-16
?
窗下有梧桐

TA贡献5条经验 获得超3个赞

。。那个不是0啊,是一个object类型的对象o

查看完整回答
1 反对 回复 2017-10-17
  • 2 回答
  • 0 关注
  • 1004 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信