黑马程序员技术交流社区
标题:
谁能帮忙讲解下重写 equals方法
[打印本页]
作者:
G_Y_C黑马
时间:
2015-8-30 22:45
标题:
谁能帮忙讲解下重写 equals方法
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Student other = (Student) obj;
if (age != other.age)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2