Skip to content

String이 hashCode()를 오버라이딩한 이유 #2

@beginin15

Description

@beginin15

image

  1. A1.hashCode()와 A2.hashCode()의 값은 같을까 다를까?
  2. A1 == A2의 결과는 true일까 false일까?
  3. A1.equals(A2)의 결과는 true일까 false일까?

Q. 여기서 1번의 결과는 같다. 이유는 String이 hashCode()를 재정의 했기 때문. 왜 재정의 되어있는가?

Metadata

Metadata

Assignees

No one assigned

    Labels

    JavaJava 관련 주제

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions