2013年9月26日星期四

java written questions


int i=1,j=10;
do{
   if(i>-j){
     continue;
   }
}while(i<5);
System.out.println(i+","+j);

Written encounter such a problem when I was writing a 1,10 . Think there is no problem . But I came back ready to programming , why not a result of running the computer got stuck , tried several times . .
------ Solution ---------------------------------------- ----
how can I have an infinite loop results are not out of circulation
------ Solution ---------------------- ----------------------
add a few print statements into you know how it happens . . . .
------ Solution ---------------------------------------- ----
infinite loop , i = 1. Always less than 5.
------ Solution ----------------------------------- ---------
infinite loop ah , i and constant
------ For reference only ------------------ ---------------------
halo . . . . .
------ For reference only -------------------------------------- -
Please observe CSDN users of Conduct , shall not violate state laws and regulations .

没有评论:

发表评论