分类信息
各地考试

当前位置:首页 » Java认证 » 模拟试题 » 正文

Java认证模拟试题(3)


时间:2013-10-31 来源:Java认证考试网 浏览次数:430  【华夏培训网:中国教育培训第一门户

question11)whatwillbetheresultofattemptingtocompileandrunthefollowingcode?abstractclassminebase{abstractvoidamethod();s

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






        Java认证

推荐图文

热门点击排行

©2015 hxpx.com All Rights Reserved 滇ICP备13002816号-1
华夏培训网唯一网址www.hxpx.com