A.-1
B.255
C.127
D.Compilationwillfail.
E.Compilationwillsucceedbuttheprogramwillthrowanexceptionatline4.
第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) { System.out.println(2>0?10:8); } } 其运行的结果是
A.2
B.0
C.10
D.8
第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题:
A.-1
B.255
C.127
D.Compilationwillfail.
E.Compilationwillsucceedbuttheprogramwillthrowanexceptionatline4.
第5题:
A.跳出循环,无输出
B.0121
C.01
D.0123