Java / Exception
In Java 7, can we catch by grouping exceptions that are hierarchically related?
We can group only un-related exceptions together. It is illegal to group exceptions which has parent-child relationship. For example, it is illegal to write a multi-catch statement like this:
FileNotFoundException is a subclass of IOException so this grouping is invalid and the compiler reports a problem that "error: Alternatives in a multi-catch statement cannot be related by subclassing".
More Related questions...