Hi guys.
Answer falsetrue is correct although numbers are in one byte range.
It's because using == operator, when on both sides are Number objects there is no unboxing, just simple reference equality.
If we write
Integer i1 = 18;
Integer i2 = 18;
System.out.println(i1 == i2);
the result would by true;
but if we replace creation of either i1 or i2 on new Integer(18); result will be false;
It's almost same as in Strings.
Java has pool of wrapper objects (only from -128 to 127) and when we create wrapper instance (without using new) we take it from pool. So if we want to take wrapper which is in pool already, we have two references to the same object.
But when we use new operator we are sure that new object is created.
Does this make sense for you?