Today while reading boxing and auto-boxing i came up with scenario and found that peculiar behavior where i was stuck in infinite loop .
I checked my code twice but i did not find any mistake. If any one can look and suggest me where i am doing wrong so that i will come out this infinite loop
kindly find the below code.
public class InTheLoop {
public static final int END = Integer.MAX_VALUE;
public static final int START = END - 100;
public static void main(String[] args) {
int count = 0;
//Infinite loop starts.
for (int i = START; i <= END; i++) {
count++;
System.out.println(count);
}
// This never got printed.
System.out.println("hi I am out of for loop" +count);
}
}