A.Finally
B.Compilationfails.
C.Thecoderunswithnooutput.
D.Anexceptionisthrownatruntime.
第1题:
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Finally”
C.Thecodecompiles,butanexceptionisthrownatruntime.
D.Thecodewillnotcompilebecausethecatchblockismissing.
第2题:
运行以下程序时,控制台上显示什么? public class Test { public static void main (String[] args) { try { System.out.println("Welcome to Java"); return; } finally { System.out.println("The finally clause is executed"); } } }
A.Welcome to Java
B.Welcome to Java 和 The finally clause is executed
C.The finally clause is executed
D.什么都不输出
第3题:
【单选题】下面程序段的执行结果是什么? public class Foo{ public static void main(String[] args){ try{ return;} finally{System.out.println("Finally"); } } }
A.编译能通过,但运行时会出现一个例外。
B.程序正常运行,并输出 "Finally"。
C.程序正常运行,但不输出任何结果。
D.因为没有catch语句块,所以不能通过编译。
第4题:
下面程序段的执行结果是()。 public class Foo{ public static void main(String[] args){ try{ return; } finally { System.out.println("Finally!");} } }
A.程序正常运行,但不输出任何结果
B.程序正常运行,并输出Finally!
C.编译能通过,但运行时会出现例外
D.因为没有catch语句块,所以不能通过编译
第5题:
下面的程序段执行结果是 public class Foo { public static void main(String[] args) { try{ return; }finally { System.out.println("finally"); } } }
A.编译通过,但运行时出现异常
B.程序正常运行,不输出任何结果
C.程序正常运行,并输出“finally”
D.因为没有catch语句,编译错误