Vous êtes sur la page 1sur 7

Exception Handling

Learners Support Publications

www.lsp4you.com

Introduction
Exceptions are errors or some peculiar problems
other than logic or syntax errors.
Exceptions are runtime anomalies or unusual
conditions that a program may encounter while
executing.

Learners Support Publications

www.lsp4you.com

Introduction
Anomalies includes :
Division by zero
Access to an array outside of its bounds
Running out of memory or disk space

Learners Support Publications

www.lsp4you.com

Basics of Exception Handling


The purpose of exception handling mechanism is
to provide means to detect and report an
exceptional circumstances so that appropriate
action can be taken.
Exceptions are of two types:
Synchronous Exception
Out-of-range index
Over-flow

Asynchronous Exception
Keyboard interrupts
Learners Support Publications

www.lsp4you.com

Basics of Exception Handling


The mechanism has error handling code that
perform the following tasks:
Find the problem ( Hit the exception )
Inform that an error has occurred ( Throw the
exception )
Receive the error information ( Catch the exception )
Take corrective actions ( Handle the exception )

Learners Support Publications

www.lsp4you.com

Exception Handling Mechanism


The error handling code basically consists of two
segments:
One to detect errors and to throw exceptions
Other to catch the exceptions and to take appropriate
actions.

Learners Support Publications

www.lsp4you.com

Thank You

Learners Support Publications

www.lsp4you.com

Vous aimerez peut-être aussi