When failing to catch a subclass of Exception
, Eclipse will issue a compilation warning (red).
However, when an subclass of Error
is uncaught, no warning is issued, making it easy to forget including the throws SomethingError
statement.
When failing to catch a subclass of Exception
, Eclipse will issue a compilation warning (red).
However, when an subclass of Error
is uncaught, no warning is issued, making it easy to forget including the throws SomethingError
statement.
This is the difference between checked (subclasses of Exception excluding RuntimeException) and unchecked exceptions (subclasses of RuntimeException or Error).
This is essentially to avoid having to add exception handling code to every trivial line of code that you write. This question explains that really well: Why are Runtime Exceptions "unchecked" in Java?