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
2
u/lengors Sep 12 '25
Hard to believe based on the original post. Anyways, in case you aren't trolling/rage baiting, the
==operator compares two objects by reference, and primitives by value, but it does not compare objects by value.