0:00

What does the following code print?

for (int i = 3; i <= 12; i++)
{
   System.out.print(i + " ");
}
可以令循环执行的最小值为3,最大值为12
4

How many times does the following method print a *?

for (int i = 3; i < 9; i++)
{
   System.out.print("*");
}
\(8-3+1=6\),注意当i变为9时循环已经终止执行了。
2

What does the following code print?

int x = -5;
while (x < 0)
{
   x++;
   System.out.print(x + " ");
}
此时x的改变在输出之前,虽然x = 0时循环条件为false,但在上一轮循环中这个值已经被打印了。
3


陈 欣

AADPS创始人

发表评论