Four requirements for a reliable equality method

A developer is reviewing an equality method for shipment labels. The equals contract specifies rules that a correct Java equality method follows. Match each named property to its requirement. Throughout the requirements, x, y, and z are non-null references.

Match each term
A.

If comparing x with y and y with z both returns true, comparing x with z returns true.

B.

Repeating a comparison gives the same result while the information used to determine equality remains unchanged.

C.

Comparing x with y gives the same result as comparing y with x.

D.

Comparing x with itself returns true.

Transitivity

Consistency

Reflexivity

Symmetry

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More The Object Class Questions: