java - Infinite loop value -
what initial values of x make loop infinite? told answer 123, don't understand how. can explain this?
do { x = x - 3; } while (x < 120);
no value cause loop infinite loop. in java, integral primitive values underflow positive number, , loop end.
as example:
int x = integer.min_value; { x = x - 3; system.out.println(x); } while (x < 120); will output:
2147483645
Comments
Post a Comment