java格林认证_Java考试格林练习题

Java考试格林练习题

question 11)

160e145a8ec735f69f4458050bbc2dd2.png

what will be the result of attempting to compile and run the following code?

abstract class minebase { abstract void amethod(); static int i;}public class mine extends minebase { public static void main(string argv[]){ int[] ar=new int[5]; for(i=0;i < ar.length;i++) system.out.println(ar[i]); }}

1) a sequence of 5 0’s will be printed

2) error: ar is used before it is initialized

3) error mine must be declared abstract

4) indexoutofboundes error

question 12)

what will be printed out if you attempt to compile and run the following code ?

int i=1; switch (i) { case 0: system.out.println("zero"); break; case 1: system.out.println("one"); case 2: system.out.println("two"); default: system.out.println("default"); }

1) one

2) one, default

3) one, two, default

4) default

question 13)

what will be printed out if you attempt to compile and run the following code?

int i=9;switch (i) { default: system.out.println("default"); case 0: system.out.println("zero"); break; case 1: system.out.println("one"); case 2: system.out.println("two");}

1) default

2) default, zero

3) error default clause not defined

4) no output displayed

【Java考试格林练习题】相关文章:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值