What are the circumstances under which a finally {} block will NOT execute?

前端 未结 9 2038
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 01:45

In a Java try{} ... catch{} ... finally{} block, code within the finally{} is generally considered \"guaranteed\" to run regardless of what occurs

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 02:16

    You can make it a part of Daemon Thread. You may use the method setDaemon(boolean status) which is used to mark the current thread as daemon thread or user thread and exit the JVM as and when required. This will enable you exit the JVM before finally{} is executed.

提交回复
热议问题