importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(String[]args)try(methodA();)catch(IOExceptione)(system.out.printIn(CaughtIOException”);)catch(Exceptione)(system.out.printIn(CaughtException”);))publicvoidmethodA(){thrownewIOException();}Whatistheresult?()A.Thecodewillnotcompile.B.Theoutputiscaughtexception.C.TheoutputiscaughtIOException.D.Theprogramexecutesnormallywithoutprintingamessage.

importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(String[]args)try(methodA();)catch(IOExceptione)(system.out.printIn(CaughtIOException”);)catch(Exceptione)(system.out.printIn(CaughtException”);))publicvoidmethodA(){thrownewIOException();}Whatistheresult?()

A.Thecodewillnotcompile.

B.Theoutputiscaughtexception.

C.TheoutputiscaughtIOException.

D.Theprogramexecutesnormallywithoutprintingamessage.


相关考题:

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.testB.ExceptionC.Compilationfails.D.NullPointerException

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.

importjava.io.IOException;publicclassExceptionTest(publicstaticvoidmain(Stringargs)try(methodA();)catch(IOExceptione)(system.out.printIn(CaughtIOException”);)catch(Exceptione)(system.out.printIn(CaughtException”);))publicvoidmethodA(){thrownewIOException();}Whatistheresult?()A.Thecodewillnotcompile.B.Theoutputiscaughtexception.C.TheoutputiscaughtIOException.D.Theprogramexecutesnormallywithoutprintingamessage.

以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)

以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)

main()方法的正确定义方式是()。A.public static void main (String [ ] args ) { new NameSurfer().start (args ) ; }B.public static main (String [ ] args ) { new NameSurfer().start (args ) ; }C.public void main (String [ ] args ) { new NameSurfer().start (args ) ; }D.public static void main (String [ ] args ) { NameSurfer().start (args ) ; }

以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)E.main()

19、以下哪个是有效的Java程序入口函数?A.public static void main(String[] args);B.public static void main();C.public static int main(String[] args);D.public static void main(int argc, String[] args)