Exception Handling


Exceptions :It refers to an abnormal condition that arises during the program execution. They are usually run-time errors.

Exception-Handling :A mechanism to handle exceptions(errors) when it occurs, so that program do not terminate abnormally, is known as exception handling.

☞ When an exception occurs in the program, we say that exception was raised or thrown. We deal with it and say it is handled or caught. And the code written to handle it is known as Exception handler.

☞ To handle an exception we can use the following statements :

  1. try-except block
  2. try with multiple except blocks
  3. try..except with finally block