Tag Archives: fun

Interesting Java Facts -2

Here is a interesting Java question. What should be values of x and y in below to make the while loop infinite / non terminating

while (x <= y&& x >= y && x != y) {

Hint: Answer lies in autoboxing.

Ok, the answer is

Integer x = new Integer(0);
Integer y = new Integer(0);

Now try to think why?