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.