Should java try blocks be scoped as tightly as possible?

后端 未结 7 1812
孤城傲影
孤城傲影 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:28

    This is premature optimization at its worst. Don't do it.

    "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" - Knuth.

提交回复
热议问题