Records and value equality

What boolean is produced?

Examples

Worked example

Input
record Point(int x, int y) {}; new Point(1, 2).equals(new Point(1, 2))
Expected output
true

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

The generated equals operation compares both component values, and both coordinates match.

Back to the lesson