There is a simple trick here.
You cannot think about it with logical logic only. Using this, this combination ...
a less than or equal to b , andb less than or equal to a , anda not equal to b
... will never return true .
However, the != Operator compares links if its operands are objects.
So, the following returns true :
Integer a = 1; Integer b = new Integer(1); System.out.println(a<=b && b<=a && a!=b);
What happens here: a , since the reference to the object is not equal to b as the reference to the object, although, of course, they have equal integer values.
Mena Sep 24 '15 at 10:54 2015-09-24 10:54
source share