public class test { public static string output =
public static void foo(int i) { try { if(i= =) { throw new Exception (); } output += ; ) catch(Exception e) { output += ; return; ) finally ( output += ; ) output += ; )
public static void main (string args[]) ( foo(); foo();
) ) What is the value of the variable output at line ? Ans: 答案怎么会输出个数字呢? 首先foo()就直接到第行output= 然后因为没有抛出异常所以直接运行行 然后运行行此时output= foo()因为抛出异常所以运行行 然后因为catch了异常然后运行finally里的语句 但是行的不再被运行因为行已经要求return了 |