首页 > 互联网 > IT认证 > JAVA认证 > Java考试格林练习题

Java考试格林练习题

   来源:学问社    阅读: 1.25W 次
字号:

用手机扫描二维码 在手机上继续观看

手机查看

  question 11)

Java考试格林练习题

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 < th;i++) tln(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: tln("zero"); break; case 1: tln("one"); case 2: tln("two"); default: tln("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: tln("default"); case 0: tln("zero"); break; case 1: tln("one"); case 2: tln("two");}

1) default

2) default, zero

3) error default clause not defined

4) no output displayed

EDA技术
嵌入式
J2EE
ACCP
JAVA认证
SUN认证
Linux认证
Adobe认证