Strings and text comparisons

Which comparison checks that their text matches?

Examples

Worked example

Input
new String("cat") and another new String("cat")
Expected output
equals

Hints and solution

Hint 1

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

Reveal worked answer

Both objects contain the same characters, so equals returns true.

Back to the lesson