To answer your question, when we talk about modern JVMs that actually apply a lot of optimizations in the code, when you write some code that is inefficient, the JVM automatically introduces optimization.
Please answer the answer in ( Java: the overhead of entering / using try-catch blocks?).
Therefore, good practice is not a big deal.
In a personal note, I believe that there is no need to encapsulate anything in try-catch , static , synchronized , etc. blocks are optional.
Let's make our code more understandable for those who will work on this. If an exception is caught, it is better to explicitly indicate which part of the code throws it.
Lack of guessing for the reader, so the JVMs are smart, write according to your wishes, make them better for people, and the JVM takes care of the optimization part.
EDIT: I read a lot of books, and I did not find a single place that says that one big attempt to catch is better than a few small ones.
In addition, many in the development community believe the opposite.
dharam Sep 13 '13 at 11:01 2013-09-13 11:01
source share