当前位置:SCJP程序员认证考试题库

问题:

[单选]

int x = 1, y =6; 
while (y--) { 
x++; 
} 
System.out.println(“x =” + x + “y =” +y);
What is the result?()  

A .  x = 6 y = 0
B .  x = 7 y = 0
C .  x = 6 y = -1
D .  x = 7 y = -1
E .  Compilation fails.

下列选项中,可以作为建设工程索赔证据的有()。 来往信件。 口头协议。 官方的物价指数。 设备的采购凭证。 图纸。 在生产实践中理论回收率与实际回收率的差值()越好。 越大。 越小。 相等。 以上都对。 简述儿童的自我中心语言及其表现范畴。 移动出价比例的设置范围为() 0.10-10.00。 0.10-1.00。 0.10-100.00。 1.00-2.00。 不同的理财计划有着不同的收益率给出形式,下列选项中,属于商业银行个人理财计划常用收益率形式的有:() 固定收益率。 最低收益率。 预期最高收益率。 浮动收益率。

int x = 1, y =6; 
while (y--) { 
x++; 
} 
System.out.println(“x =” + x + “y =” +y);
What is the result?()  

参考答案:

  参考解析

A ‘while’ statement can only evaluate a Boolean expression. The expression while(y--) returns an int rather than a Boolean. Therefore, the correct answer is E. 

在线 客服