How should Java String contents usually be compared?
Practice this question from Quiz: Sorting and String Checks, with options and an explanation.
Question
How should Java String contents usually be compared?
Option A — Correct answer
.equals()
.equals checks character content; == checks object references.
Option B
== only
Option C
=
Option D
!=