标题: catch和finally问题 [打印本页] 作者: hacker◊紫猫 时间: 2014-10-7 21:43 标题: catch和finally问题 假如在catch里面有return语句,请问finally里面的代码还会执行吗?如果执行,是在return前,还是return后? 作者: 鲁行 时间: 2014-10-7 22:07
这个会执行的,在return前执行.下面给个代码可以验证:
class Test1
{
public static void main(String[] args)
{
int x = method();
System.out.println(x);
}
public static int method()
{
int a = 10;
int b = 0;