itgle.com

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

题目

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.inner

B.innerouter

C.middleouter

D.innermiddleouter


相似考题
更多“classBirds{publicstaticvoidmain(String[]args){try{thrownewException();}catch(Exceptione){t ”相关问题
  • 第1题:

    现有

    classParserextendsUtils{

    publicstaticvoidmain(String[]args){

    try{System.out.print(newParser().getlnt("42"))

    }catch(Exceptione){

    System.out.println("Exc");}

    }

    intgetlnt(Stringarg)throwsException{

    returnInteger.parselnt(arg);

    }

    }

    classUtils{

    intgetlnt(){return42;}

    }

    结果是什么?()


    参考答案:C

  • 第2题:

    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.


    参考答案:A

  • 第3题:

    给定以下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、finallyexceptioninmainfinished

    B、exceptioninmainfinally

    C、finallyfinished

    D、finallyexceptioninmainfinished


    正确答案:C

  • 第4题:

    现有: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.innerouter

    B.middleouter

    C.innermiddleouter

    D..编译失败


    参考答案:C

  • 第5题:

    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.finally

    B.exceptionfinished

    C.finallyexceptionfinished

    D.Compilationfails.


    参考答案:C