Notice that your catch block catches "Exceptions". It doesn't catch IOException. One of the descendents of Exception is RuntimeException. As RuntimeExceptions need not be declared, you are free to try to catch them at any time. If you change that catch block to catch an IOException, I'll bet you'll get the compiler error you expected. Corey [ June 19, 2002: Message edited by: Corey McGlone ]
Exception is the only checked exception that can be declared within a catch clause without being thrown.
SCJP2. Please Indent your code using UBB Code
Joined: Aug 29, 2001
how about Throwable?
Joined: Dec 20, 2001
Originally posted by Thiru Thangavelu: how about Throwable?
Only descendents of Exception (with the exclusion of RuntimeException) are considered checked exceptions. Anything else (RuntimeException and anything higher on the inheritance hierarchy) is not checked. Corey