Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

 

Introduction to exception handling

Exception handling enables a programmer to cater for exceptional or problematic scenarios by defining a method of overriding the normal program flow during execution. When an exception occurs the normal program flow is interrupted and execution is directed to a piece of code in place to handle the exception which is called the catch statement.

 

How exceptions effect program flow

 

Using a try catch block

 

Using the throw statement

 

The advantages of using exception handling

 

The disadvantages of using exception handling

There are no real disadvantages of the proper use of exception handling, however take care not to swallow exceptions or the program may yield unexpected results!