I fixed an endless loop by changing Integer to int in the following:
public class IntTest {
public static void main(String[] args) {
Integer x=-1;
Integer total=1000;
while(x != total){
System.out.println("x =" + x + "total ="+ total);
x++;
}
}
}
What is the proper reason for this? I figured Integer would compare no problem.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…