How many statements in a try/catch statement?

前端 未结 13 1249
予麋鹿
予麋鹿 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:24

    You can handle multiple types of exceptions through single try / catch loop. But take care of order in which you are going to handle exceptions. Order of catch exception block does matter.

提交回复
热议问题