SpinTheMic
Pro

Interview practice question

String comparison works sometimes

Backend Engineering · Language Runtimes · Beginner

A Java check if (status == "ACTIVE") works in some tests but fails in production. Why?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • == compares references, not content.
  • String literals interned, so tests pass.
  • Strings from DB/network are new objects.
  • Use equals() or enums.
  • Objects.equals for null safety.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics