3 ms·
It 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 prim
by RobAtticus 15y ago
It 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...