题目内容 (请给出正确答案)
[主观题]

下面程序的输出结果是()。public class Sun{public static void main(String args[ ]){int x=0;fo

下面程序的输出结果是()。 public class Sun { 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.7

B.15

C.157

D.538

提问人:网友zenggeqiang 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“下面程序的输出结果是()。public class Sun{…”相关的问题
第1题
阅读下列的程序 public class Test3 { public static void main(String[] args) { _________________________ _________________________ } } class Outer { static class Inner { public void method () { System.out.println("method"); } } } 下列选项中,可以正确输出method()方法的是( )

A、Outer o = new Outer(); o.method();

B、Inner I = new Inner(); i.method();

C、Outer.Inner oi = new Outer.Inner(); oi.method();

D、以上答案都不对

点击查看答案
第2题
public class StaticTester extends Base{ static{ System.out.println("test static"); } public StaticTester(){ System.out.println("test constructor"); } public static void main(String[] args) { new StaticTester(); } } class Base{ static{ System.out.println("base static"); } public Base(){ System.out.println("base constructor"); } } 运行这个Java程序后,输出结果是()。

A、base static base constructor test static test constructor

B、test static test constructor base static base constructor

C、base static test static base constructor test constructor

D、test static base static test constructor base constructor

点击查看答案
第3题
下面代码的输出结果是什么?class Foo { public static void main(String args[]){ int x=4,j=0; switch(x){ case 1:j++; case 2:j++; case 3:j++; case 4:j++; case 5:j++; default :j++; } System.out.println(j); } }
点击查看答案
第4题
下面程序的输出结果是( )。static void Main(string[] args) { int k = 0, m = 0, i, j = 0; for (i = 0; i < 2; i++) { for (j = 0; j < 3; j++) k++; k -= j; } m = i + j; Console.WriteLine("k={0},m={1}", k, m); }

A、k=0,m=3

B、k=0,m=5

C、k=1,m=3

D、k=1,m=5

点击查看答案
第5题
下面的程序中,哪行会报错? public class StaticTest { int age; String name; static int totalFee = 500; public void showName() { System.out.print(this.name); } public static void showTotalFee() { line 1: System.out.print(totalFee); line 2: showName(); } public static void main(String[] args) { line3: StaticTest.showTotalFee(); } }

A、line 1

B、line 2

C、line 3

点击查看答案
第6题
下面程序的运行结果是( )。 public static void main(String[] args) { int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length); }

A、60

B、20

C、30

D、50

点击查看答案
第7题
下面程序的运行结果是? public static void main(String[] args) { int x = 8; int y = 4; if(x++>8 && ++y<4){ system.out.print(x); }else{ system.out.print(y); } system.out.printf("%d%d",x,y);> A、995

B、985

C、494

D、495

点击查看答案
第8题
下列程序的执行,说法正确的是( )class MultiCatch { public static void main(String args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42]=99; //10行 System.out.println(“b=”+b); } catch(ArithmeticException e) { System.out.println(“除0异常:”+e); //15行 } catch(ArrayIndexOutOfBoundsException e) { System.out.println(“数组超越边界异常:”+e); //19行 } } }

A、程序将输出第15行的异常信息

B、程序第10行出错

C、程序将输出“b=42”

D、程序将输出第19行的异常信息

点击查看答案
第9题
运行以下代码: class Equals{ public static void main(String[] args){ int x=100; double y=100.1; boolean b=(x=y); System.out.println(b); } } 运行结果是( )。

A、true

B、false

C、编译出错

D、抛出一个异常

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信