Java catch block, caught exception is not final

前端 未结 4 1102
长发绾君心
长发绾君心 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:45

    It's pretty much the same as method arguments:

    You usually don't modify them and many people agree that they should be treated as final (whether or not to actually write final in front of them is a matter of some debate).

    But since there's no technical requirement that says it must be final, the language gives you the option to choose.

    Personally I know of no good reason to modify the exception reference of a catch-block.

提交回复
热议问题