Overview
Overview
In Java’s try statement, each and every catch block catches the thrown exception by matching the exact type which is thrown. The exact type thrown should be reifiable to get it caught using Try-Catch statement.
Reifiable Types
Reifiable type is a type which can be completely represented at run-time.
Eg, A primitive type, non-parameterized class or interface type, parameterized type of unbounded wildcard (
), raw type (List), Array whose component is reifiable (
)
Typed Exception
The afore-mentioned code will result in the following error.
Restriction
The user might need to write such an extension to handle it the following way.
But this will never work as the type provided in the catch clause is not at all reifiable.