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

Java考试格林模拟试题2

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

  which of the following are keywords or reserved words in java?

  1) if

  2) then

  3) goto

  4) while

  5) case

  question 7)

  which of the following are legal identifiers

  1) 2variable

  2) variable2

  3) _whatavariable

  4) _3_

  5) $anothervar

  6) #myvar

  question 8)

  what will happen when you compile and run the following code?

  public class myclass{ static int i; public static void main(string argv[]){ system.out.println(i); }}

  1) error variable i may not have been initialized

  2) null

  3) 1

  4) 0

  question 9)

  what will happen if you try to compile and run the following code?

  public class q { public static void main(string argv[]){ int anar[]=new int[]{1,2,3}; system.out.println(anar[1]); }}

  1) 1

  2) error anar is referenced before it is initialized

  3) 2

  4) error: size of array must be defined

  question 10)

  what will happen if you try to compile and run the following code?

  public class q { public static void main(string argv[]){ int anar[]=new int[5]; system.out.println(anar[0]); }}

  1) error: anar is referenced before it is initialized

  2) null

  3) 0

  4) 5

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

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

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