11.staticclassA{12.voidprocess()throwsException{thrownewException();}13.}14.staticclassBextendsA{15.voidprocess(){System.out.println(”B”);}16.}17.publicstaticvoidmain(String[]args){18.newB().process();19.}Whatistheresult?()A.BB.Thecoderunswithnooutput.C.Compilationfailsbecauseofanerrorinline12.D.Compilationfailsbecauseofanerrorinline15.E.Compilationfailsbecauseofanerrorinline18.

11.staticclassA{12.voidprocess()throwsException{thrownewException();}13.}14.staticclassBextendsA{15.voidprocess(){System.out.println(”B”);}16.}17.publicstaticvoidmain(String[]args){18.newB().process();19.}Whatistheresult?()

A.B

B.Thecoderunswithnooutput.

C.Compilationfailsbecauseofanerrorinline12.

D.Compilationfailsbecauseofanerrorinline15.

E.Compilationfailsbecauseofanerrorinline18.


相关考题:

classBirds{publicstaticvoidmain(String[]args){try{thrownewException();}catch(Exceptione){try{thrownewException();}catch(Exceptione2){System.out.print(inner);}System.out.print(middle);}System.out.print(outer);}}结果为:()A.innerB.innerouterC.middleouterD.innermiddleouter

现有:1.classPropeller2{2.latemiddle);}voidgo()//addcodehere?12.{thrownewException();}13.}为使代码通过编译,需要在哪一行加入声明throwsException?()

现有:classBirds{publicstaticvoidmain(String[]args){try{thrownewException();}catch(Exceptione){try{thrownewException();}catch(Exceptione2){System.out.print(inner);}System.out.print(middle);}System.out.print(outer);}}结果是()A.innerouterB.middleouterC.innermiddleouterD..编译失败

现有:voidtopGo(){try{middleGo();}catch(Exceptione){System.out.print(catch);}}voidmiddleGo()throwsException{go();system.out.print(latemiddle);}voidgo()throwsExceptiOn{thrownewException();}如果调用topGo(),则结果为:()A.latemiddleB.catchC.latemiddlecatchD.catchIatemiddle

publicclassTest{publicstaticvoidaMethod()throwsException{try{thrownewException();}finally{System.out.println(finally”);}}publicstaticvoidmain(Stringargs[]){try{aMethod();}catch(Exceptione){System.out.println(exception”);}System.out.println(finished”);}}Whatistheresult?()A.finallyB.exceptionfinishedC.finallyexceptionfinishedD.Compilationfails.

Given:11.staticclassA{12.voidprocess()throwsException{thrownewException();}13.}14.staticclassBextendsA{15.voidprocess(){System.out.println(B);}16.}17.publicstaticvoidmain(String[]args){18.Aa=newB();19.a.process();20.}Whatistheresult?()A.Compilationfailsbecauseofanerrorinline19.B.Anexceptionisthrownatruntime.C.BD.Compilationfailsbecauseofanerrorinline18.E.Compilationfailsbecauseofanerrorinline15.F.Thecoderunswithnooutput.

使用jdbc 编写class EnrollmentImpl 实现接口 Enrollment:public interface Enrollment{public void createStudent(Student student) throws Exception;pubic void createCourse(Course course) throws Exception;public void enroll(Student student, Course course) throws Exception;public void exam(Student, Course course, float grade) throws Exception;}

给定以下JAVA代码,这段代码编译运行后输出的结果是( )publicclassTest{publicstaticintaMethod(inti)throwsException{try{returni/10;}catch(Exceptionex){thrownewException("exceptioninaaMothod");}finally{System.out.print("finally");}}publicstaticvoidmain(String[]args){try{aMethod(0);}catch(Exceptionex){System.out.print("exceptioninmain");}System.out.print("finished");}}A、finallyexceptioninmainfinishedB、exceptioninmainfinallyC、finallyfinishedD、finallyexceptioninmainfinished

给定如下Java代码片段,则下列调用方法正确的是()。 Public int count (int i) throws Exception { if (i==0) throw new Exception(“参数不正确!”); return 20/i; }A.public void useCount(){ count(0); }B.public void useCount() throws Exception{ count(0); }C.public void useCount(){ try { count(10); }catch(ArithmeticException e){} }D.public void useCount(){ try{ count(10); } }