首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序段的输出结果是( )。 public class Test { public static void main (String[) args) { int a,b; for(a=1,
下面程序段的输出结果是( )。 public class Test { public static void main (String[) args) { int a,b; for(a=1,
admin
2012-12-13
28
问题
下面程序段的输出结果是( )。 public class Test { public static void main (String[) args) { int a,b; for(a=1,b=1;a<=100;a++) { if (a>=10 ) break; if (b%2==1) { b+=2; continue; } } System. out. pdntln(A); } }
选项
A、7
B、8
C、9
D、10
答案
D
解析
虽然程序中的for循环是变量a从1到100,但程序中a=10时,遇到break语句,退出循环,所以退出循环后a=10,选择D。
转载请注明原文地址:https://jikaoti.com/ti/AK80FFFM
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
下面程序的输出结果是()。ls=["橘子","芒果","草莓","西瓜","水蜜桃"]forkinls:print(k,end="")
考生文件夹下存在一个文件“PYl03.py”,请写代码替换横线。不修改其他代码,实现以下功能。用键盘输入一个9800-981l的正整数n,作为Unicode编码,把n-1、n、n+1这3个Unicode值对应字符按照如下格式要求输出到屏幕:宽度为11个字
以下关于Python字典变量的定义中,正确的是()。
设元素集合为D={1,2,3,4,5,6}。B=(D,R)为线性结构则R是()。
以下程序Dog类中__init__()方法共包含()个形参。ClassDog():def__init__(self,name,age):self.name=nameself.age=age
对软件设计中应遵循的准则描述正确的是()。
软件生命周期是指()。
下列关于Applet的叙述中,错误的是
在Java线程模型中,一个线程是由______、______和______三部分组成。
在java.awt包中______是一种透明的容器,没有标题和边框。
随机试题
可用作隔热耐火砖的是()。
sprays
患者,女,40岁。大便次数增多,带血2个月,伴便意频繁,大便变形,变细,大便隐血(++),直肠指诊:距肛门8cm触到一肿物约3cm×3cm大小,尚可活动,指套上有血迹,病理诊断直肠腺癌,对其最主要的治疗方法是
根据《药品经营监督管理办法》,开办药品零售企业应符合设置规定,下列与规定不符合的是
影子价格依据经济分析的定价原则测定,主要反映()。
资源消耗计划编制的依据是()。
旅顺博物馆是一座馆场丰富的历史艺术类博物馆,下列对其描述正确的是()。
下列行为不属于《中华人民共和国行政诉讼法》规定的受案范围的是()。
下面对软件测试描述错误的是()。
HowdidthetravellerhearaboutNewYork?WhatsurprisedthetravelleraboutNewYork’sairport?
最新回复
(
0
)