A.true
B.false
C.Compilationfails.
D.Anexceptionisthrownatruntime.
第1题:
A.finished
B.Compilationfails.
C.AnAssertionErroristhrown.
D.AnAssertionErroristhrownandfinishedisoutput.
Thisquestionisabittrickybecauseitlacksthefollowinginformation:Itshouldincludeastatementthatsayswhetherornotassertionsareenabled.Iftheyareindeedenabled,the
correctionanswerisC.butiftheyarenot,thecorrectanswerisA.Assertionsarenotenabledbydefaultsoifthequestionisnotchanged,themostlogicalanswerisA.
第2题:
下面的程序会抛出什么异常类型? public class Test { public static void main(String[] args) { Object o = null; System.out.println(o); } }
A.ArithmeticException
B.ArrayIndexOutOfBoundsException
C.StringIndexOutOfBoundsException
D.没有异常
第3题:
2、1、写出以下程序的输出内容。 public class Test { public static void changeValue(int value){ value = 0; } public static void main(String[] args) { int value = 2010; changeValue(value); System.out.println(value); } }
第4题:
下面代码运行后的输出结果为()。 public class Test { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(bb.equals(aa)); } } class AB{ int x = 100; }
A.true
B.false
C.编译错误
D.100
第5题:
下面的程序会抛出什么异常类型? public class Test { public static void main(String[] args) { Object o = null; System.out.println(o.toString()); } }
A.ArrayIndexOutOfBoundsException
B.StringIndexOutOfBoundsException
C.ClassCastException
D.NullPointerException