public class Eddy {
public static void main (String args []) {
int j=10;
int I=1;
do
{
if (I++>--j)
continue;
}while(I<5);
System.out.println(I);
System.out.println(j);
}
}
这种题目考查的是对do....while循循语句的理解程度do..while是执行do{}语句块一次先。所以这个循环至少执行一次do{}的内容.
解析如下:
首先执行一下do{}语句块先。执行完之后I=2 j=9
然后再到while条件去判断
当I=3 j=8
当I=4 j=7
当I=5 j=6 当I=5时,已经不符合循环条件了,所以退出循环
Therefore,this issue ths result of:
I=5
j=6