finally的
public class FinallyTest2 {
public static void main(String[] args) {
System.out.println(new FinallyTest2().test());
}
@SuppressWarnings("finally")
public int test()
{
int x = 1;
try{
++x;
int z = x/0;
return x;
}catch(Exception e){
++x;
return x;
}finally{
++x;
//return x;
}
}
}
打印结果为 3 Java中 Finally的解析
最新推荐文章于 2022-08-09 19:31:39 发布
