This means Exception1
is what they call an unchecked exception, which means the method from which it originates does not need to declare that it can throw it. Lots of common runtime errors are unchecked (NullPointerException
, for example.) If Exception1
were what they call a checked exception, you would get a compiler error - a checked exception means one that either must be caught where the method throws it, or must have the enclosing method declare that it throws it. At the same time, there's nothing to stop you from declaring that a method throws an exception that's unchecked, which is what the writer of call()
chose to do.
The root of all exceptions is Throwable
, which is unchecked. Throwable
has two main subclasses: Error
, which is unchecked, along with all its descendants; and Exception
, which is checked. All of Exception
's descendants are checked exception for RuntimeException
. Here is a good article illustrating what I've described.
In the years over which Java has evolved, there has been some debate over whether checked exceptions are a good safety feature, or a nuisance. Some programmers make lots of their exceptions unchecked, removing the clutter of exception handling and catching all exceptions at key chokepoints in their code. Other programmers think that's dangerous and unclear, and feel checked exceptions are a form of self-documentation. You can come to a conclusion with which you are comfortable. Here is an SO post about this debate and here is a good article on it.