Today i come across the peculiar behaviour of equlaity operator.
I’d expect the answer to be false. We’re testing for reference equality here, after all – and when you box two values, they’ll end up in different boxes, even if the values are the same, right
Object x = 129;
Object y = 129;
boolean equality = (x == y);
System.out.println(equality);
OUTPUT : FALSE
Object x = 12;
Object y = 12;
boolean equality = (x == y);
System.out.println(equality);
OUTPUT : TRUE
Can some one help me understanding why this is behaving like this.