Java catch block, caught exception is not final

前端 未结 4 1050
长发绾君心
长发绾君心 2021-02-04 07:05

I am checking out the new features of Java SE7 and I am currently at this point:

http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html

4条回答
  •  离开以前
    2021-02-04 07:35

    The reason I can think of to enforce it final is due to performance. Once the catch evaluation starts, having a final immutable value in the mechanics of the evaluation ensures a faster evaluation of all catches. Since try-catch is extensively used throughout any java code, the highest performance design is preferable.

    Based on the above, it implies a performance improvement that affects most programs.

提交回复
热议问题