Nothing happens. The catch block will only catch an exception thrown in the Try block. If nothing happens in the try block, then no exception could ever possibly be thrown and therefore whatever is in the catch block would never be executed.
It wont throw a compiler issue, i.e. it will compile. But its pointless to add such a thing to any application.
e and t exceptions are also allowed. Are they also considered as checked exceptions?
The compiler will not complain about any unchecked exception -- or any throwable class that an unchecked exception is an instance of. There are unchecked exceptions that are instance of the Exception and Throwable classes, hence, it will not complain.
But even though Exception is not checked, compiler still requires it to be checked :-) So why not to call it checked? The same is true for Throwable.
Joined: Apr 25, 2005
How the compiler will know which exception object is thrown from foo() method. It could be an instance of IOException which is checked so compiler will force you to catch it or declare it by throws clause.