首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序段的输出结果为【 】。 int a=2; switch (A){ case 2: System. out. print( "Value is 2."); case 3 : System. out. println( "Value is 3. ")
下列程序段的输出结果为【 】。 int a=2; switch (A){ case 2: System. out. print( "Value is 2."); case 3 : System. out. println( "Value is 3. ")
admin
2010-12-17
21
问题
下列程序段的输出结果为【 】。
int a=2;
switch (A){
case 2:
System. out. print( "Value is 2.");
case 3 :
System. out. println( "Value is 3. ");
break;
default:
System. out. println ("end ");
break;
}
选项
答案
Value is 2. Value is 3.
解析
switch语句的表达式a将依次与case后的值进行匹配,如果遇到匹配的值,则执行该case子句后的语句序列。当表达式的值与任意一个case子句的值都不匹配时,执行default后的语句。break语句用来在执行完一个case子句后,使程序跳出switch语句。此题先执行case2后的语句再执行case 3后的语句,遇到case 3中的break语句后退出。
转载请注明原文地址:https://kaotiyun.com/show/B49p777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
下列叙述中正确的是
下列关于栈叙述正确的是
公司的开发人员可以同时参加多个项目的开发,则实体开发人员和实体项目间的联系是
定义部门关系模式:部门(部门号,部门名,部门成员,部门总经理),使它不满足第一范式的属性是
给出如下代码:importrandomnum=random.randint(1,10)whileTrue:ifsum>=9:breakelse:nnm=random.randint(1,10)以下选项中描述错误的是
关于Python程序格式框架的描述,以下选项中错误的是
关于结构化程序设计方法原则的描述,以下选项中错误的是
关于映射类型,描述正确的是
下面关于Python标准库和第三方库的说法正确的是()。
关系模型的完整性规则是对关系的某种约束条件,包括实体完整性、______和自定义完整性。
随机试题
患者,女,26岁。腹痛、腹泻2周,抗感染治疗无效。病程中伴有四肢关节酸痛及低热。体格检查:面部对称性暗红色斑疹,双手指甲周红斑,指腹侧瘀点。实验室检查:外周血WBC4.2×109/L、RBC302×1012/L、Hb116g/L、PLT86×109
颈椎病最常见的类型是
A.蛇眼疔B.蛇肚疔C.足底疗D.蛇头疔E.托盘疔初起时多局限于指甲一侧边缘的近端,有轻微的红肿疼痛,一般2~3天成脓,属于()
支气管呼吸音发生在何部位有病理意义
流行性出血热传染源主要是( )霍乱传染源主要是( )
2006年国际商会巴黎会议上通过的经修改的《跟单信用证统一惯例》(UCP600)于2007年7月1日实施。下列哪些选项属于UCP600修改或规定的内容?(卷一/2007年第85题)
某工程,建设单位与甲施工单位按照《建设工程施工合同(示范文本)》签订了施工合同。经建设单位同意,甲施工单位选择了乙施工单位作为分包单位。在合同履行过程中,发生了如下事件。事件1:在合同约定的工程开工目前,建设单位收到甲施工单位报送的《工程开工报审
托收属商业信用,托收银行与代收银行对托收的款项能否收到负有责任。()
求Y(x),并求Y=Y(x)到x轴的最大距离;
设直线L:及平面π:4x一2y+z一2=0,则直线L().
最新回复
(
0
)