4 ms·
A checked exception is one that the compiler forces you to write a check for. An unchecked exception ("the good kind") is one that you could write a check for
by Roboprog 13y ago
A checked exception is one that the compiler forces you to write a check for. An unchecked exception ("the good kind") is one that you could write a check for if you want to.
You probably want to have at least one exception "catch" block somewhere, such as within a message/event handler loop, but checked exceptions force you to write the error catch at the place where a routine is called, and MANY such checks for other calls, rather than at one place at the top of an operation.
While this might make sense in a GUI/AWT/Swing app, it does not make sense in a batch processing app (or web app). In that case, there is no user to get a dialog box, you simply log "it did not work due to ..." and move on. Checked exceptions make you write a bunch of extra code.
- StavrosK 13y agoI see, thanks. I have to say I'm not a big fan of checked exceptions, but it is what it is... Thanks for the information!
- Roboprog 13y agoAlas, as much as I like golang, this is one area that it seems to have got worse than Java: error codes instead of exceptions, preferably unchecked exceptions like C# uses (and other languages, I presume)