Short answer
== compares references (true only for the same object, e.g., two literals), equals() compares content code-unit by code-unit, equalsIgnoreCase() folds ASCII-ish case, and compareTo() gives lexicographic ordering by UTF-16 value for sorting.
Explanation
The gotcha is case and ordering are not locale-correct: toUpperCase()/toLowerCase() and natural ordering can be wrong for non-English locales (the Turkish dotless-i is the famous example), so use Locale-aware methods or a Collator for human-facing comparison and sorting.
Common mistakes
- Using == to compare string content.
- Calling toUpperCase() without a Locale (the Turkish 'i' problem).