|
Exceptions can be handled at runtime by enclosing statements that might generate an exception inside an @try block, whose general format is as follows: @try programStatement 1 @catch (exception) programStatement 2 @catch (exception) ... @finally programStatement n If an exception is thrown by programStatement 1, the @catch blocks that follow will be tested (in order) to see if the corresponding exception matches the one that was thrown. If it does, the corresponding programStatement will be executed. Whether or not an exception is thrown and caught, the @finally block, if supplied, will be executed. |