Exception Handling Question

后端 未结 8 680
谎友^
谎友^ 2020-12-13 02:30

I have a question regarding exception handling. Consider following Java code snippet.

        try{
            //code
        }catch(SubSubException subsube         


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 02:57

    The second approach is significantly less readable because:

    • it requires more symbols,

    • it requires deeper indentation,

    • it is not idiomatic.

    And IMO, the last is most important. You should be writing your code in a way that other Java programmers expect it to be written.

提交回复
热议问题