How to make loop infinite with “x <= y && x >= y && x != y”?

前端 未结 4 816
南方客
南方客 2020-12-16 11:07

I had this interview question some years ago but I haven\'t found the answer yet.

What should be x and y to make a infinite loop?

while (x <= y&am         


        
4条回答
  •  -上瘾入骨i
    2020-12-16 11:45

    Here it is.

    Integer x =1;
    Integer y = new Integer(1);
    while(x <= y&& x >= y && x != y) {
        System.out.println("Success");
    }
    

提交回复
热议问题