Should java try blocks be scoped as tightly as possible?

后端 未结 7 1778
孤城傲影
孤城傲影 2020-12-01 00:35

I\'ve been told that there is some overhead in using the Java try-catch mechanism. So, while it is necessary to put methods that throw checked exception within a try block t

7条回答
  •  离开以前
    2020-12-01 01:17

    No. The only thing that you should be considering is where you can reasonably handle the exception and what resources you need to reclaim (with finally).

提交回复
热议问题