A.Line26prints“a”toSystem.out.
B.Line26prints?b”toSystem.out.
C.Anexceptionisthrownatline26atruntime.
D.CompilationofclassAwillfailduetoanerrorinline6.
第1题:
1.publicclassa{
2.publicvoidmethod1(){
3.try{
4.Bb=newb();
5.b.method2();
6.//morecodehere
7.}catch(TestExceptionte){
8.thrownewRuntimeException(te);
9.}
10.}
11.}
1.publicclassb{
2.publicvoidmethod2()throwsTestException{
3.//morecodehere
4.}
5.}
1.publicclassTestExceptionextendsException{
2.}
Given:
31.publicvoidmethod(){
32.Aa=newa();
33.a.method1();
34.}
WhichistrueifaTestExceptionisthrownonline3ofclassb?()
第2题:
1.publicclassA{2.3.privateintcounter=0;4.5.publicstaticintgetInstanceCount(){6.returncounter;7.}8.9.publicA(){10.counter++;11.}12.13.}GiventhiscodefromClassB:25.Aa1=newA();26.Aa2=newA();27.Aa3=newA();28.System.out.printIn(A.getInstanceCount());Whatistheresult?()
A.CompilationofclassAfails.
B.Line28printsthevalue3toSystem.out.
C.Line28printsthevalue1toSystem.out.
D.Aruntimeerroroccurswhenline25executes.
E.Compilationfailsbecauseofanerroronline28.
第3题:
A.protectedintblipvert(longx){return0;}
B.protectedlongblipvert(intx){return0;}
C.privateintblipvert(longx){return0;}
D.privateintblipvert(intx){return0;}
E.publicintblipvert(intx){return0;}
F.protectedlongblipvert(longx){return0;}
G.protectedlongblipvert(intx,inty){return0;}
第4题:
A.Anexceptionisthrownatruntime.
B.Compilationfailsbecauseofanerrorinline7.
C.Compilationfailsbecauseofanerrorinline4.
D.CompilationsucceedsandnoruntimeerrorswithclassAoccur.
第5题:
A.ClassA
B.Compilationfails.
C.Anexceptionisthrownatline2.
D.Anexceptionisthrownatline6.
E.Thecodeexecuteswithnooutput.