Reply to post: Re: so wrong

Oracle's Java 15 rides into town, waving the 'we're number one' flag, demands 25th birthday party

james_smith Silver badge

Re: so wrong

That's not a quirk - you need to understand the difference between instance (or reference) and logical equality. Each instance of a class is inherently unique, so == should almost only ever be used on primitive types. C++ makes a mess of this by allowing operator overloading so that reference and logical equality often become confused, a quirk - of C++ - that Java's designers were at pains to avoid.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

SUBSCRIBE TO OUR WEEKLY TECH NEWSLETTER

Biting the hand that feeds IT © 1998–2020