Skip to content

[아이템19] readResolve와 writeReplace #20

Description

@rlooo

pg. 127

Serializable 을 구현한 상속용 클래스가 readResolvewriteReplace 메서드를 갖는다면 이 메서드들은 private이 아닌 protected로 선언해야 한다.

  • private으로 선언한다면 하위 클래스에서 무시되기 때문이다.
  • 상속을 허용하기 위해 내부 구현을 클래스 API로 공개하는 예 중 하나이다.

readResolvewriteReplace 메서드가 어떤 역할을 해서 private이 아닌 protected로 구현해야 하는지 궁금합니다.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions