3 ms·
Well, unfortunately autoboxong will silently call valueOf(). So Integer val1 = 5; Integer val2 = 5; Integer val3 = 200; Integer val4 = 200; w
by monocasa 3y ago
Well, unfortunately autoboxong will silently call valueOf(). So
Integer val1 = 5;
Integer val2 = 5;
Integer val3 = 200;
Integer val4 = 200;
will have you ending up with val1 and val2 being equal with ==, but val3 and val4 won't be.
The general reply is 'you're holding it wrong', but that doesn't make it any less absurd. That's what the PHPers say about "123" < "456A" < "78" < "123".
- paulddraper 3y agoIDK it makes sense to me. Unless you call `new` there's no guarantee that you have a different object.