Why do Java people frequently consume exceptions silently?

前端 未结 28 1725
傲寒
傲寒 2020-11-29 17:50

I never did any serious Java coding before, but I learned the syntax, libraries, and concepts based on my existing skills (Delphi & C#). One thing I hardly understand i

28条回答
  •  广开言路
    2020-11-29 18:10

    1. Java forces you to handle all Exceptions explicitly. If a method that your code calls is declared to throw FooException and BarException your code MUST handle (or throw) those exceptions. The only exception to this is RuntimeException, which is silent like a ninja.
    2. Lots of programmers are lazy (myself included), and it's very easy to just print the stack trace.

提交回复
热议问题