When comparing a Wrapper (say an Integer) and a primitive of a different type(anything other than int, say long), I seem to get a weird result. Normally == comparison is stricter because it compares the actual object vs equals which just compares for meaningful equality.
Please take a look at the following code:
This prints the following:-
This doesn't make sense to me. The boxing that is going on here should be the same in both cases. So if == gives true, equals() should also give true.
Why is equals() method giving a false result here?
"A problem well stated is a problem half solved.” - Charles F. Kettering
SCJP 6, OCPJWCD