Java考试格林练习题
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 < 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
-
java程序员面试题
Sun认证Java程序员考试旨在考察您通过应用软件分配进行复杂编程的能力。之后还要测试您完成编程所需的知识。以下是小编整理的java程序员面试题,希望大家认真阅读!第一,谈谈final,finally,finalize的区别。第二,AnonymousInnerClass(匿名内部类)是否可以extends(继...
-
2016年最新JAVA编程题及答案
【程序1】题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。1.程序分析:利用for循环控制100-999个数,每个数分解出个位,十位,百位。【程序2】题目:古典问题:有...
-
Java认证面试试题及答案
面试是java认证考试环节之一,那么java面试有哪些经典试题呢?下面yjbys小编为大家分享最新java面试经典试题及答案,仅供考生参考!1.Java中的异常处理机制的简单和应用当Java程序违反了Java的语义规则时,Java虚拟机就会将发生的错误表示为一个异常。违反语义规则包...
-
Java考试格林模拟题
question14)whichofthefollowinglinesofcodewillcompilewithouterror1)inti=0;if(i){tln("hello");}2)booleanb=true;booleanb2=true;if(b==b2){tln("sotrue");}3)inti=1;intj=2;if(i==1||j==2)tln("ok");4)inti=1;intj=2;if(i==1&|j==2)tln("ok");questio...