r/javahelp • u/MaryScema • Sep 12 '25
Codeless == compares all object attributes so why everyone says it’s wrong?
Why everybody talks nonsense when talking about == operator in Java? It’s simple as comparing all objects’ attributes otherwise it wouldn’t make sense and the developers wouldn’t have done it
0
Upvotes
View all comments
Show parent comment
1
u/Hei2 Sep 12 '25
Obviously. "== is wrong" is just as nonsensical as "+ is wrong", or "a is wrong", or "6 is wrong". Those statements don't mean anything at all without any additional context. "6 is wrong" only makes sense in a context like "what is the answer to 1 + 2?"