public class ExceptionTest { public void tryFinally() { try { tryItOut(); } finally { wrapItUp(); } } // auxiliary methods public void tryItOut() { } public void wrapItUp() {} }
public void tryFinally(); Code: 0: aload_0 1: invokevirtual #2 // Method tryItOut:()V 4: aload_0 5: invokevirtual #3 // Method wrapItUp:()V 8: goto 18 11: astore_1 12: aload_0 13: invokevirtual #3 // Method wrapItUp:()V 16: aload_1 17: athrow 18: return Exception table: from to target type 0 4 11 any
0: aload_0 1: invokevirtual #2 // Method tryItOut:()V 4: aload_0 5: invokevirtual #3 // Method wrapItUp:()V 18: return
Exception table: from to target type 0 4 11 any
11: astore_1 12: aload_0 13: invokevirtual #3 16: aload_1 17: athrow
12: aload_0 13: invokevirtual #3
16: aload_1 17: athrow
public void tryFinally() { try { tryItOut(); return; } finally { wrapItUp(); } }
0: aload_0 1: invokevirtual #2 // Method tryItOut:()V 4: aload_0 5: invokevirtual #3 // Method wrapItUp:()V 8: return 9: astore_1 10: aload_0 11: invokevirtual #3 // Method wrapItUp:()V 14: aload_1 15: athrow
public void tryCatchFinally() { try { tryItOut(); } catch (TestExc e) { handleExc(e); } finally { wrapItUp(); } }
public void tryCatchFinally(); Code: 0: aload_0 1: invokevirtual #2 4: aload_0 5: invokevirtual #3 8: goto 31 11: astore_1 12: aload_0 13: aload_1 14: invokevirtual #5 17: aload_0 18: invokevirtual #3 21: goto 31 24: astore_2 25: aload_0 26: invokevirtual #3 29: aload_2 30: athrow 31: return Exception table: from to target type 0 4 11 Class TestExc 0 4 24 any 11 17 24 any
END 十期推荐 【271期】面试官:Spring MVC的处理流程是怎样的? 【272期】数据结构:哈希表原理以及面试中的常见考点 【273期】告诉面试官,我能优化groupBy,而且知道得很深! 【274期】面试官:怎么保证缓存和数据库一致性 【275期】面试官:你对MySQL中的索引了解多少? 【276期】面试官:你分析过@Annotation注解的实现原理吗? 【277期】面试官:说几种常用的分布式 ID 解决方案 【278期】面试官:都说 select * 效率低下,你知道什么原因吗? 【279期】面试官:Java遍历Map集合有哪几种方式?各自效率怎么样? 【280期】k8s面试问什么? ? ~