Hi,
Sorry to be asking such a question, not sure where else to ask it.
A friend sent me the below code as it was performing oddly (she is a tester trying to pick up
Java).
I think there is some strange autoboxing thing going, now I avoid autoboxing as much as possible.
in the first two comparisons, I think the comparison is being autoboxed so that it is comparing the
value of the Integers.
In the third one I think it is comparing the addresses of foo and bar.
So far so good, the next two comparising I think are autoboxed.
Now here is where the madness kicks in, the final comparison returns true, foo1 and bar1 are equal.
So is it autoboxing, well I dont think so. As it turns out, in InteliJ the reference for foo1 and bar1 are the same!!!
Is this the result of a widening operation?
Any help or suggestions would be great.
Thanks.
Gavin