3 ms·
Yuck, what a nightmare. 1000 should equal 1000.
by funkah 15y ago
Yuck, what a nightmare. 1000 should equal 1000.
- RobAtticus 15y agoIt does, but their memory locations need not be the same. Making the == operator act differently just because the Objects in question are boxed version of primitives would probably be more of a nightmare than having the == operator act consistently. Perhaps a better solution would be a compiler warning so these mistakes can be identified quicker.
- morsch 15y agoArguably making the == operator mean two different things -- equal in value and equal in reference -- is the problem to start with. I'd prefer it if == was a value comparison in all cases, and reference comparison were mapped to === or something. I guess the extra verbosity doesn't get a lot of fans here...