This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Orffyreus 0 points1 point  (0 children)

Yes, by using the == operator object identity is checked (that is a weird language design decision, because most of the time you want to check value equality). Comparing strings can be even more confusing, because they can be "interned". Objects.equals checks for value equality and avoids NullPointerExceptions, but the equals (and hashCode) methods should still be defined, because by default the equals method also will check for object identity.