参考于-Java核心技术:- @Override
- public boolean equals(Object otherObject)
- {
- if(this == otherObject)
- return true;
-
- if(otherObject == null)
- return false;
-
- if(getClass() != otherObject.getClass())
- return false;
-
- Person p = (Person)otherObject;
-
- return name.equals(p.name) && (number == p.number);
- }
复制代码 |