Java Professional — Hard
Key points
- The `intern()` method returns a canonical representation of the string
- `==` compares references, not values
- String literals are stored in a string pool
- `s1` and `s2` are different objects, while `s2` and `s3` point to the same string literal
Ready to go further?
Related questions
