Writing Methods

AP Computer Science A· difficulty 4/5

A correctly overridden equals starts with

  • A

    return o.equals(this);

  • B

    if (this == o) return true; if (!(o instanceof MyClass)) return false; ...

    check_circle
  • C

    return true;

  • D

    throw new Exception();

Explanation

Standard equals contract: handle reference equality, type, then content.

Want 10 more like this — adaptive to your weak spots?

Related questions