Unit 9 Exception Handling
Unit 9 Exception Handling
Division by zero
y=1
Note that the program did not stop at the point of exceptional
condition. It catches the error condition, prints the error
message and then continues the execution as if nothing has
happened.
Out Put
• Note that the array element a[2] does not exist because array a is
try try
{ {
…….. …….
…… ……..
} }
finally catch (…..)
{ {
……. ……
……. …….
} }
.
.
finally
{
……..
……….
}
This chapter includes:-
›Debugging.
›Types of errors such as compile time errors and
run-time errors.
›Exception handling in C#.
›Try and catch statements.
›Multiple catch statements.
›Finally block