CHAPTER OUTLINE
CHAPTER TEN
EXCEPTION HANDLING
-4 HOURS
10.1 Error Handling
10.2 Exception Handling Constructs (try, catch, throw)
10.3 Advantages over Conventional Error Handling
10.4 Multiple Exception Handling
10.5 Rethrowing Exception
10.6 Catching All Exceptions
10.7 Exception with Arguments
10.8 Exceptions Specification for Function
10.9 Handling Uncaught and Unexpected Exceptions
ERROR AND ERROR HANDLING
→ An error is a bug in a program or software which causes it operate
incorrectly.
→ Error must be minimized for a software product or program to run
efficiently.
→ Following are the different types of errors:-
Syntax error:- The syntax error occurs due to the poor understanding of
the programming language. It is similar to the grammatical mistakes in
English language. However, in context of computer, syntax error would
prevent the program from being compiled.
Run-time error:- The run time error occurs when program is in the state
of running. Memory space running out, array out of the bound error,
divide by zero error etc are some examples of run time error which can
cause a running program to terminate.
Logical error:- The logical error occurs due to the poor understanding
of the problem. Logical error can be minimized by reviewing the
literature through books, journal articles, conference proceedings etc.
Latent error:- The hidden or unknown errors are known as latent errors.
→ Error handling refers to the anticipation, detection, and resolution of errors
in the program.