This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
When you have a catch block, you provide an "argument" like this:
In this example, "IOException ioe" and "Exception e" are the "arguments" that are being passed to the exception block.
Say, for example, that our try block throws a RuntimeException, which is a subclass of Exception. There is no catch block for a RuntimeException. However, the way exception handling works is that, if no catch block is found for the given type of exception, the JVM will look for a catch block of any superclasses of the exception thrown. In this case, we have one - Exception. Because a RuntimeException "is a" type of Exception (it extends Excepetion), this makes sense. Therefore, since there is no specific way to handle a RuntimeException, we'll handle it just like we would an Exception.