本文介绍了finally和finalize块之间的差异处理不完整?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
finally和finalize块之间的差异处理不完整处理?用例子说明。
difference between finally and finalize block inexception handling??Explain with example.
推荐答案
最后是异常处理时执行的块,如果发生异常的话。因此,它允许您在try-catch-finally-block中的所有其他操作之后进行操作或清理。所以它是方法级别的清理。
Finally is the block that is executed on exception handling if or not exception occurred. So it gives you change to do operations or cleanup after everything else in try-catch-finally-block. So it is for method level clean up.
当垃圾收集器收集类的实例时,Finalizer是解构器来进行任何清理。终结器例如是水平清理。
Finalizer is deconstructor to do any cleanup when garbage collector collects instance of the class. Finalizer is for instance level clean up.
这篇关于finally和finalize块之间的差异处理不完整?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!