题目内容 (请给出正确答案)
[单选题]

下列程序的输出结果是什么?publicclassHope{publicstaticvoidmain(String[]args){Hopeh=newHope();}protectedHope(){for(inti=0;i<10;i++){System.out.println(i);}}}

A.0123456789

B.编译错误

C.onstructorcannotbeprotected.

D.12345678910

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“下列程序的输出结果是什么?publicclassHope{p…”相关的问题

第1题

下列程序的输出结果是什么?publicclassHope{publicstaticvoidmain(String[]args){Hopeh=newHope();}protectedHope(){for(inti=0;i<10;i++){System.out.println(i);}}}

A、0123456789

B、编译错误

C、onstructorcannotbeprotected.

D、12345678910

点击查看答案

第2题

下列程序的输出结果是( )。 public class ArrayTest { public static void main(String args[]) { int[]intArray=new int[3] for(int i=0;i<3;i++) { intArray[i]=i+2: system.out.println("lntArray["+i+"]¨= intArray[i]); } System.out.println("----------"); int arrlen=4: IntArray=new int[arrLen]; For(int j=intArray.length;j>=0;j--) { intArray[j]=j*3; system.out.println("hello"+intArray[j]); } } }

A.编译未通过

B.编译通过,但运行错误

C.可以运行,但有错误

D.以上都不对

点击查看答案

第3题

下列程序的输出结果是( )。 public class ArrayTest { public static void main(String args[]) { int[]intArray=new int[3] for(int i=0;i<3;i++) { intArray[i]=i+2: system.out.println("lntArray["+i+"]¨= intArray[i]); } System.out.println("----------"); int arrlen=4: IntArray=new int[arrLen]; For(int j=intArray.length;j>=0;j--) { intArray[j]=j*3; system.out.println("hello"+intArray[j]); } } }

A.编译未通过

B.编译通过,但运行错误

C.可以运行,但有错误

D.以上都不对

点击查看答案

第4题

下列程序的输出结果是( )。 public class Test { public static void main(String[] args) { char a1 = 'B', a2 = 'c'; if(a1+1<a2) ++a1; System. out. println(a1); } }

A.B

B.b

C.C

D.c

点击查看答案

第5题

下列程序的输出结果是( )。 public class Test{ public static void main(String[]args){ int[]array=(2,4,6,8,lO); int size=6; int result =-1: try{ for(int i=0;i(size 8L&result= = -1;) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch- - -l"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch- - -2"); } catch(Exception e){ System.out.println("Catch- - -3");) } }

A.Catch- - -1

B.Catch- - -2

C.Catch- - -3

D.以上都不对

点击查看答案

第6题

下列程序的输出结果是( )。 Public class Test{ Public static void main(String[]args){ int[]array=(2,4,6,8,10); int size=6; int result=-l: try{ for(int i=0;i<sizeresult= =-1:) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch---1"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch---2"): } catch(Exception e){ System.out.println("Catch---3"): } }

A.Catch---1

B.Catch---2

C.Catch---3

D.以上都不对

点击查看答案

第7题

下列程序的输出结果为( )。 public class Reentrant { public synchronized void a() { b(); System.out.println("here I am, in a()"); } public synchronized void b() { System.out.println("here I am, in b()"); } public static void main(String args[ ]) { Reentrant r=new Reentrant(); r.a(); } }

A.here I am, in a()/here I am, in b()

B.hereI am, in b()/here I am, in a()

C.here I am, in a()

D.here I am, in b()

点击查看答案

第8题

下列程序的输出结果是( )。 public class Test { public static void main (String[] args) { int n=5,sum=0; while (n>0) { sum+=n; --n; } System.out.println("Sum is"+sum); } }

A.sum is 14

B.sum is 15

C.sum is 10

D.sum is 5

点击查看答案

第9题

执行下列程序段之后,输出的结果是( )。public class Test{ public static void main(String[ ] args) { byte a = 2; short b = 3; long c = 4; c=a%b*4%b; System.out.println(c) ; } }

A.2

B.1

C.-1

D.-2

点击查看答案

第10题

下列程序的输出结果是( )。 public class Test { public static void main (String[] args) { String s="hello"; s.replace ('r','m'); System.out.println(s); } }

A.hello

B.HELLO

C.hemmo

D.HEMMO

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

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

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

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

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