How many statements in a try/catch statement?

前端 未结 13 1247
予麋鹿
予麋鹿 2021-01-12 12:42

Should I put multiple statements in a try and then catch all possible exceptions, or should I put only one statement in the try statement?

Example:



        
13条回答
  •  一生所求
    2021-01-12 13:15

    you can use any of them.

    but if using the first then you should catch the more specific exceptions.

提交回复
热议问题