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

给出下面一段程序,选择运行结果() public class X{ public static void main(String[] args){ S

给出下面一段程序,选择运行结果() public class X{ public static void main(String[] args){ String names[] = new String[5]; for(int x=0; x<args.length; x++) names[x]="args[x];" system.out.println(names[2]); } 命令行执行:java x> A、运行出现异常

B、b

C、null

D、names

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“给出下面一段程序,选择运行结果() public class…”相关的问题

第1题

给出下面一段程序,选择运行结果( ) public class X{ public static void main(String[] args){ int nums[] = new int[5]; System.out.println(nums[2]); } } 命令行执行:java X 结果是下面哪一个?

A、运行出现异常

B、null

C、0

D、false

点击查看答案

第2题

阅读以下程序,给出运行结果。

publicclassCase{

publicstaticvoidmain(Stringargs[]){

floatx=11;

floaty=4;

intz=(int)(x%y);

switch(z){

case1:

x=x+1;

case2:

x=x+2;

default:

x=x+3;

}

System.out.println(“Valueofxis:”+x);

}

}

运行结果是:

点击查看答案

第3题

阅读程序,给出结果。

  public class Fibonacci{

   public static void main(String args[]){

    System.out.println("fib(4)="+fib(4));

   }

   static int fib(int n){

    if(n==0 | | n==1) {

     return n;

    }

    else {

     int sum=fib(n-1)+fib(n-2);

     return sum;

    }

  }

  }

  输出结果为:______

点击查看答案

第4题

下面程序段的输出结果是( )。 public class Test( public static void main(String args[]){ int[]a=new int[113; int[]p=new int[43; int k=5: for(int i=1;i<=10;i++) a[i]=i; for(int i=1;i<=3;i++) p[i]=a[i*i]; for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }

A.37

B.31

C.33

D.35

点击查看答案

第5题

下面程序段的输出结果是( )。 public class Test( public static void main(String args[]){ int[]a=new int[113; int[]p=new int[43; int k=5: for(int i=1;i<=10;i++) a[i]=i; for(int i=1;i<=3;i++) p[i]=a[i*i]; for(int i=1;i<=3;i++) k=k+p[i]*2; System.out.println(k); } }

A.37

B.31

C.33

D.35

点击查看答案

第6题

下面程序段的输出结果是( )。 public class Test{ public static void main(String args[]){ int X,y; x=(int)Math.sqrt(5)/2+(int)Math.random*5/2; y=(int)Math.sqrt(3)/2+(int)Math.random*3/2; if(x>v) System.OUt.println("x>y"); elseif(x= =y) System.out.println("x=Y"); else System.out.println("x<y"): } }

A.x>y

B.x=Y

C.x<y

D.编译错误

点击查看答案

第7题

下面程序的运行结果是( )。 public class Test { public static void main (String args[]) { int c=5; System. out. println (C); System. out. println (c++); System. out. println (C); } }

A.5 6 6

B.5 5 6

C.6 7 7

D.6 6 6

点击查看答案

第8题

下面程序的运行结果是()

public class demo {

public static void main(string[] args) {

try { system.out.println(10 / 0)

system.out.println("除法正常运行")

} catch (arithmeticexception e) {

system.out.println("除数不能为0")

}

}

}

</p>

A、编译失败

B、编译通过,没有结果输出

C、输出:除法正常运行

D、输出:除数不能为0

点击查看答案

第9题

下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { int j=2,i=5; while (j<i--) j++; System.out.println(j);} }

A.2

B.3

C.4

D.5

点击查看答案

第10题

下面程序段的输出结果是( )。 public class Test { public static void main (String[] args) { int n=10; do { System.out.println("n is"+n); }while(--n>10); } }

A.n is 8

B.没有输出

C.n is 10

D.n is 9

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

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

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

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