Does a finally block run even if you throw a new Exception?

后端 未结 6 895
梦毁少年i
梦毁少年i 2020-12-22 20:42

In this code will someVar be set even if the catch block is executed and the second Exception is thrown?

public void someFunction() throws Excep         


        
6条回答
  •  天涯浪人
    2020-12-22 20:51

    The finally block always executes when the try block exits.unless you've System.exit(0) in your try or catch.

提交回复
热议问题