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.
Vyas Sanzgiri wrote:InterruptedException is a subclass of Exception so why does the compiler "pick" on InterruptedException and not on Exception
Because the Java specification allows to catch Exception (but not specific checked exceptions.) The point is that you could catch a runtime exception with an Exception catch. And, the compiler can only enforce this rule for checked exceptions, because they are the only ones that methods are forced to declare.
All code in my posts, unless a source is explicitly mentioned, is my own.