That’s my while loop, and the question is, how can i get a true condition?
s and t are Integer variables
while (s<=t && s>=t && s!=t )
EDIT
tl;dr the original question stated:
s and t are int variables (and OP commented they are not Integer variables)
By boxing the primitive value in an object:
The
rsltboolean here will indeed evaluate totrue.However, the following would return false:
it is because in Java, for objects,
==means that it is indeed the same instance, whileequalsis left up to be implemented by every class and typically means that the core values of the compared objects are the same — while not necessarily being the same class instance (AKA object). The> and <for boxed primitives are evaluated agaist the primitive value, however==is checking the object identity.