문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | 마지막 판 양쪽 다음 판 | ||
java:equals_hashcode [2017/07/04 01:02] kwon37xi [동치 문제의 최종 해결책 canEqual] |
java:equals_hashcode [2017/07/04 01:02] kwon37xi [동치 문제의 최종 해결책 canEqual] |
||
---|---|---|---|
줄 77: | 줄 77: | ||
// that.canEqual(this) 호출을 통해서 상위클래스(Point)는 결코 ColoredPoint와 같을 수 없게 보장됨. | // that.canEqual(this) 호출을 통해서 상위클래스(Point)는 결코 ColoredPoint와 같을 수 없게 보장됨. | ||
- | @Override public boolean canEqual(Object other) { | + | @Override |
+ | public boolean canEqual(Object other) { | ||
return (other instanceof ColoredPoint); | return (other instanceof ColoredPoint); | ||
} | } |