niusouti.com

publicclassfoo{publicstaticvoidmain(string[]args)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?()A.Theprogramrunsandprintsnothing.B.Theprogramrunsandprints“Finally”C.Thecodecompiles,butanexceptionisthrownatruntime.D.Thecodewillnotcomp

题目
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.printIn(Finally”);}}Whatistheresult?() ”相关问题
  • 第1题:

    publicclassFoo{publicstaticvoidmain(String[]args){try{return;}finally{System.out.println(Finally”);}}}Whatistheresult?()

    A.Finally

    B.Compilationfails.

    C.Thecoderunswithnooutput.

    D.Anexceptionisthrownatruntime.


    参考答案:A

  • 第2题:

    下面程序段的执行结果是()。 public class Foo{ public static void main(String[] args){ try{ return; } finally { System.out.println("Finally!");} } }

    A.程序正常运行,但不输出任何结果

    B.程序正常运行,并输出Finally!

    C.编译能通过,但运行时会出现例外

    D.因为没有catch语句块,所以不能通过编译


    B

  • 第3题:

    【单选题】下面程序段的执行结果是什么?   public class Foo{    public static void main(String[] args){     try{       return;}       finally{System.out.println("Finally");      }    }   }

    A.编译能通过,但运行时会出现一个例外。

    B.程序正常运行,并输出 "Finally"。

    C.程序正常运行,但不输出任何结果。 

    D.因为没有catch语句块,所以不能通过编译。


    14

  • 第4题:

    publicclassfoo{publicstaticvoidmain(stringargs)try{return;}finally{system.out.printIn(Finally”);}}Whatistheresult?()

    A.Theprogramrunsandprintsnothing.

    B.Theprogramrunsandprints“Finally”

    C.Thecodecompiles,butanexceptionisthrownatruntime.

    D.Thecodewillnotcompilebecausethecatchblockismissing.


    参考答案:B

  • 第5题:

    下面的程序段执行结果是 public class Foo { public static void main(String[] args) { try{ return; }finally { System.out.println("finally"); } } }

    A.编译通过,但运行时出现异常

    B.程序正常运行,不输出任何结果

    C.程序正常运行,并输出“finally”

    D.因为没有catch语句,编译错误


    B