Is there such case when in try\finally block the finally won't be executed?

后端 未结 4 1909
日久生厌
日久生厌 2020-12-07 00:49

I\'m studying for my test in Object Oriented Programming and I was wondering if there is any case what so ever that considering the following code:

try {
            


        
4条回答
  •  隐瞒了意图╮
    2020-12-07 01:28

    Yes. If you crash the Java VM or otherwise muck things up via native code, cause the program to terminate, or loop/wait infinitely inside the try block.

    Those are the only three cases which will avoid executing the finally block.

提交回复
热议问题