EXCEPTION
EXCEPTION
Exception handling
Exception handling is the
unexcepted / unwanted /
abnormal situation that
occurred at the run time .
Syntax:
try{
//protected code
}catch( exception e1 ){
//catch block
}catch( exception e2 ){
//catch block
}catch( exception eN ){
//catch block
}
Program example:
If the value of z = 0 then it was
sure that the program would
have been thrown an exception,
as anything divided by 0 gives
indefinite value and gives an run
time error.
Then an exception message
would have been appeared as
an output which is declared in
the catch and the program
would have been ended up.