首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int
下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int
admin
2013-03-01
36
问题
下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int i=1;i<=4;i++) { x=4; for(int j=1;j<=3; j++) { x=3; for(int k=1; k<=2; k++) x=x+6; } } System. out. println (x); } }
选项
A、36
B、48
C、144
D、15
答案
D
解析
题目中是一个三个循环的嵌套,但是每次循环时,x都将重新赋值,所以只计算最后一次即可,x=3,执行了两次x=x+6,所以x=15,选D。
转载请注明原文地址:https://kaotiyun.com/show/p32p777K
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
以下程序的输出结果是()。 foriinrange(3): forjin”dream”: ifj==”e”: continue print(j,end=””)
下面关于递归函数的描述中,错误的是()。
如果指令中的地址码部分直接给出了操作数,则称为()。
某系统结构图如下所示: 该系统结构图是()。
下列叙述中正确的是()。
以下关于Python处理二进制文件的描述中,错误的是()。
Java中访问限定符有【】,protected,private和default等。
数据流图用于抽象描述一个软件的逻辑模型,数据流图由一些特定的图符构成。下列图符名标识的图符不属于数据流图合法图符的是
公司中有多个部分和多名职员,每个职员只能属于一个部门,一个部门可以有多名职员,从职员到部门的联系类型是
随机试题
影响体质形成的先天因素有
A.雌激素B.雄激素C.孕激素D.人绒毛膜促性腺激素E.黄体生成素
A.白前B.百部C.前胡D.芥子E.桔梗性微寒,既降气祛痰,又宜散风热的药是()。
流体以层流掠过平板时,在x长度内的平均表面传热系数h与x处局部换热系数hx之比h:hx为()。
某建筑场地的土层分布及各土层的剪切波速如题图所示,土层等效剪切波速为240m/s,试问,该建筑场地的类别应为下列()项所示。
建设工程设备采购合同条款规定,卖方应在合同设备启运前和启运后合同规定的时间内预通知和正式通知买方的事项主要包括()。
下面的网络设备中,能够抑制网络风暴的是()。
阅读材料,回答问题:我们的会议之所以称为政治协商会议,是因为三年以前我们曾和蒋介石国民党一道开过一次政治协商会议。那次会议的结果是被蒋介石国民党及其帮凶们破坏了,但是已在人民心中留下了不可磨灭的印象。那次会议证明,和帝国主义的走狗蒋介石国民党及其帮凶们一
Whatistherelationshipbetweenthetwospeakers?
Idislikeitsshapeandcolor,______(最真正吸引我的)itsoriginality.
最新回复
(
0
)