-
107 votesanswersviews
Java Try Catch Finally块没有Catch
我正在审查一些新代码 . 该程序只有一个try和一个finally块 . 由于catch块被排除在外,如果遇到异常或任何可抛出的东西,try块如何工作?它只是直接进入finally块吗? -
4 votesanswersviews
尝试,捕获,最终执行[重复]
可能重复:在finally块中抛出异常 只有在try块中抛出异常时才会执行catch块 . 如果抛出异常,则始终在try(-catch)块之后执行finally块 . 我的问题是 IF 我在finally块中遇到的异常比如何处理它????? -
323 votesanswersviews
Try-finally块阻止StackOverflowError
看看以下两种方法: public static void foo() { try { foo(); } finally { foo(); } } public static void bar() { bar(); } 运行 bar() 显然会产生 StackOverflowError ,但运行 foo() 不会(程序似乎无限期运... -
4 votesanswersviews
在try finally块中从try块返回
我有两个代码片段,我从try返回并且最终也是块 . 第一个工作正常,最后也打印出来,后来在标记为line1的行上给出了编译时错误 . 第一个片段 class abc { public static void main(String args[]) { System.out.println("1"); try { return; } cat... -
5 votesanswersviews
finally块中的堆栈溢出错误处理
我有一个java程序,运行无限次 . 程序代码: void asd() { try { //inside try block System.out.println("Inside try !!!"); asd(); } finally { //inside finally ...