Interview Q&A / Java
Java interview questions
Collections, the JVM, strings, exceptions and threads, the backbone of most campus placement rounds.
Prefer rapid revision? Practise Java short interview answers →
- What is the difference between == and equals() in Java, and what is the String pool?
== checks whether two references point to the same object, while equals() checks whether two objects have the same content (if the class overrides it, as String does). String literals are stored once in the String pool, which is why two identical literals can be == but new String("x") cannot.
BeginnerIn-depth3 min read