C H A P T E R 22
- What Are Exceptions?
- The try Statement
- The Exception Classes
- The catch Clause
- Examples Using Specific catch Clauses
- The catch Clauses Section
- The finally Block
- Finding a Handler for an Exception
- Searching Further
- Throwing Exceptions
- Throwing Without an Exception Object
What Are Exceptions?
An exception is a runtime error in a program that violates a system or application constraint, or a condition that is not expected to occur during normal operation. Examples are when a program tries to divide a number by zero or tries to write to a read-only file. When these occur, the system catches the error and raises an exception.
If the program has not provided code to handle the exception, the system will halt the program. ...