首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列代码的执行结果是( )。 public c1ass Test { public static vold mai n(Stri ng[]args){ i nt[]x={0,1,2,3}; for {i nt i =0;i <3;1+=2){
下列代码的执行结果是( )。 public c1ass Test { public static vold mai n(Stri ng[]args){ i nt[]x={0,1,2,3}; for {i nt i =0;i <3;1+=2){
admin
2012-12-02
49
问题
下列代码的执行结果是( )。
public c1ass Test {
public static vold mai n(Stri ng[]args){
i nt[]x={0,1,2,3};
for {i nt i =0;i <3;1+=2){
try {
systc m.out .pri ntln(x[i +2]/x[i]+x[i +1]);
}
catch (ArithmeticException e){
Syste m.out .pri ntln("errorl");
}
catch (Exception e){
Syste m.out .pri ntln ("error2");
}
}
}
}
选项
A、error1
B、error2
C、error1orror2
D、2error2
答案
C
解析
当0作为除数时,会产生异常,而ArithmeticException 和Exception 两类异常都内部被捕捉到。
转载请注明原文地址:https://jikaoti.com/ti/lbkiFFFM
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
下列战役按时间先后顺序排列正确的是()。①武汉会战②淞沪会战③徐州会战④太原会战⑤枣庄会战
甲贩运假烟,驾车路过某检查站时,被工商执法部门拦住检查。检查人员乙正登车检查时,甲突然发动汽车夺路而逃。乙抓住汽车车门的把手不放,甲为摆脱乙,在疾驶时突然急刹车,导致乙头部着地身亡。甲对乙死亡的心理态度属于下列哪一选项?()
2013年修订的《商标法》中新增的可以作为商标申请注册的标志是()。
寡头垄断企业的定价方法不包括()。
发展服务业要注意避免产业空心化,这一提示是必要的,但认为中国经济增长中现代服务业快速发展就一定导致产业空心化这种看法是不对的,也是相当危险的,在实际工作中持这种看法,就会使中国经济失去快速发展现代服务业的重要窗口期。实际上,形成以服务业为主的产业结构,并不
设函数f(x)在点x=1的某邻域内有定义,且满足3x≤f(x)≤x2+x+1,则曲线y=f(x)在点x=1处的切线方程为________.
设在SQLServer2008某数据库中,已建立了四个文件组:fg1、fg2、fg3和fg4,以及一个分区函数RangePF1。RangePF1的定义代码如下:CREATEPARTITIONFUNCTIONRangePF1(int)ASR
设有表示学生选课的三张表,学生S(学号,姓名,性别,年龄,身份证号),课程C(课号,课名),选课SC(学号,课号,成绩),则表SC的关键字(键或码)为
以下与表达式(!x==0)的逻辑值不等价的选项是
对于函数声明:voidfun(floatarray[],int*ptr);以下叙述中正确的是()。
随机试题
“杏林春暖”中的“杏林”指代的是()。
新生儿胃容量约为
下列关于低钾血症临床表现的描述,不正确的是()
A.内踝前下方凹陷中,当周骨结节与内踝尖连线的中点处B.外踝前下方,趾长伸肌腱的外侧凹陷中C.外踝高点上2寸,腓骨前缘D.外踝高点上3寸,腓骨前缘E.外踝高点上4寸,腓骨前缘悬钟穴的定位是
有关“流水节拍”的概念,正确的解释是()。
根据下面材料回答下列问题。2011年年末全国60岁及以上人口达到()。
ABC公司对劳务收入的确认采用完工百分比法。2011年2月1日该公司与客户签订了一项劳务合同,合同总收入为200万元,预计合同总成本为180万元,合同期限为2年。截至2011年12月31日,该工程实际已经发生成本108万元,则ABC公司2011年度应确认的
描述数据通信的基本技术参数是【 】与误码率。
Somepeopleseemtohaveaknack(诀窍)forlearninglanguages.Theycanpickupnewvocabulary,masterrulesofgrammar,andlear
A、TheShoppingmallhasbeendesertedrecently.B、Shopperscanonlyfindgoodstoresinthemall.C、Lotsofpeoplemovedoutof
最新回复
(
0
)