package Test;
// by xserver
public class TestC
{
public static void main(String args[])
{
System.out.println(new TestC().Test());
}
public int Test()
{
int i[] = new int[3];
try
{
i[4] = 7;
return 1;
} catch (Exception e)
{
System.out.println(e);
return 2;// 如果catch不返回,那么最后必须有一个返回
} finally
{
System.out.println("finally"); // 始终都会执行
// return 0;//不可以写return的~
}
// return 3;// catch写了的话,这里就不能写
}
}
finally & return
最新推荐文章于 2025-04-25 10:00:18 发布