原帖由 qweasdzxc 于 2009-12-24 11:03 AM 发表
public class Test
{
private static int todo()
{
int b = 1;
try
{
int a = 2 / 0;
}
catch (Exception e)
{
System.out.println("in catch");
return b;
}
finally
{
b = 3;
System.out.println("in final");
}
return 2;
}
/**
* @param args
*/
public static void main(String[] args)
{
System.out.println(todo());
}
}
如题。final 的结果如下。
in catch
in final
1
为何不是
in catch
in final
3
请解释。哈哈
欢迎光临 JBTALKS.CC (https://jbtalks.my/) | Powered by Discuz! X2.5 |