A.x=0
B.x=42
C.Compilationfailsbecauseofanerrorinline2ofclassTest2.
D.Compilationfailsbecauseofanerrorinline3ofclassTest1.
E.Compilationfailsbecauseofanerrorinline4ofclassTest2.
第1题:
A.1
B.2
C.3
D.编译失败
第2题:
A.0
B.null
C.Compilationfails.
D.ANullPointerExceptionisthrownatruntime.
E.AnArrayIndexOutOfBoundsExceptionisthrownatruntime.
第3题:
A.finished
B.Compilationfails.
C.AnAssertionErroristhrown.
D.AnAssertionErroristhrownandfinishedisoutput.
Thisquestionisabittrickybecauseitlacksthefollowinginformation:Itshouldincludeastatementthatsayswhetherornotassertionsareenabled.Iftheyareindeedenabled,the
correctionanswerisC.butiftheyarenot,thecorrectanswerisA.Assertionsarenotenabledbydefaultsoifthequestionisnotchanged,themostlogicalanswerisA.
第4题:
publicstaticvoidmain(String[]args){try{args=null;args[0]=test”;System.out.println(args[0]);}catch(Exceptionex){System.out.println(”Exception”);}catch(NullPointerExceptionnpe){System.out.println(”NullPointerException”);}}Whatistheresult?()
A.test
B.Exception
C.Compilationfails.
D.NullPointerException
第5题:
A.finished
B.Compilationfails.
C.AnAssertionErroristhrownandfinishedisoutput.
D.AnAssertionErroristhrownwiththemessage“assertionfailed”.
E.AnAssertionErroristhrownwiththemessage“assertionpassed”.