网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
publicclassfoo{publicstaticvoidmain(stringargs)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?()
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Finally”
C.Thecodecompiles,butanexceptionisthrownatruntime.
D.Thecodewillnotcompilebecausethecatchblockismissing.
参考答案
更多 “ publicclassfoo{publicstaticvoidmain(stringargs)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?() A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”C.Thecodecompiles,butanexceptionisthrownatruntime.D.Thecodewillnotcompilebecausethecatchblockismissing. ” 相关考题
考题
Given1.publicclassFoo{2.publicstaticvoidmain(String[]args)}3.try{return;}4.finally{Syste.out.printIn(Finally”);}5.}6.}Whatistheresult()?
A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”.C.Thecodecomiles.Butanexceptionisthrownatruntime.D.Thecodewillnotcompilebecausethecatchblockismissing.
考题
staticvoidtest(){try{Stringx=null;System.out.print(x.toString()+);}finally{System.out.print(finally);}}publicstaticvoidmain(String[]args){try{test();}catch(Exceptionex){System.out.print(”exception);}}Whatistheresult?()A.nullB.finallyC.nullfinallyD.Compilationfails.E.finallyexception
考题
publicclassfoo{publicstaticvoidmain(string[]args)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?()
A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”C.Thecodecompiles,butanexceptionisthrownatruntime.D.Thecodewillnotcompilebecausethecatchblockismissing.
考题
publicclassFoo{publicstaticvoidmain(String[]args){try{return;}finally{System.out.println(Finally”);}}}Whatistheresult?()
A.FinallyB.Compilationfails.C.Thecoderunswithnooutput.D.Anexceptionisthrownatruntime.
考题
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.
考题
publicclassfoo{publicstaticvoidmain(Stringargs){Strings;system.out.printIn(s=”+s);}}Whatistheresult?()
A.Thecodecompilesand“s=”isprinted.B.Thecodecompilesand“s=null”isprinted.C.Thecodedoesnotcompilebecausestringsisnotinitialized.D.Thecodedoesnotcompilebecausestringscannotbereferenced.E.Thecodecompiles,butaNullPointerExceptionisthrownwhentoStringiscalled.
考题
下面程序段的执行结果是()。 public class Foo{ public static void main(String[] args){ try{ return; } finally { System.out.println("Finally!");} } }A.程序正常运行,但不输出任何结果B.程序正常运行,并输出Finally!C.编译能通过,但运行时会出现例外D.因为没有catch语句块,所以不能通过编译
考题
下面的程序段执行结果是 public class Foo { public static void main(String[] args) { try{ return; }finally { System.out.println("finally"); } } }A.编译通过,但运行时出现异常B.程序正常运行,不输出任何结果C.程序正常运行,并输出“finally”D.因为没有catch语句,编译错误
考题
【分录题】(9-2)请阅读程序,写出程序运行结果。 public class Demo8 { public static void main(String args[]) { int b = get(); System.out.println(b); } public static int get() { try { return 1; } finally { return 2; } } }
热门标签
最新试卷