频道栏目
首页 > 资讯 > JAVA > 正文

Java考试格林模拟试题3

16-06-07        来源:[db:作者]  
收藏   我要投稿
  question 11)

  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

相关TAG标签
上一篇:Java考试格林模拟试题4
下一篇:Java考试格林模拟试题2
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站