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.
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.B
D.Compilationfailsbecauseofanerrorinline18.
E.Compilationfailsbecauseofanerrorinline15.
F.Thecoderunswithnooutput.
相关考题:
Given:10.publicvoidservice(ServletRequestrequest,11.ServletResponseresponse){12.ServletInputStreamsis=13.//insertcodehere14.}Whichretrievesthebinaryinputstreamonline13?() A.request.getWriter();B.request.getReader();C.request.getInputStream();D.request.getResourceAsStream();
现有:1.classPropeller2{2.latemiddle);}voidgo()//addcodehere?12.{thrownewException();}13.}为使代码通过编译,需要在哪一行加入声明throwsException?()
现有: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
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.
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.
使用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
Given11.publicinterfaceStatus{12./*insertcodehere*/intMY_VALUE=10;13.}Whichthreearevalidonline12?() A.finalB.staticC.nativeD.publicE.private
给定如下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); } }