Next:
Summary
Up:
All Units
Unit 10
Program errors and exception handling
Summary
Types of program errors
Syntax errors
Semantic errors
Logical errors
Errors detected by the compiler and runtime errors
Drivers for testing
Techniques for detecting errors (debugging)
Debugging by inserting output statements
Execution of the program by means of a debugger
Handling errors during the execution of programs
The hierarchy of exceptions
How to handle exceptions
The most common types of exceptions
The
throws
clause
Checked exceptions and runtime exceptions
Definition of new exceptions
The
throw
statement
Example
How to catch an exception
The
getMessage()
method
Example of exception handling
Propagation of exceptions
Interrupting the propagation of exceptions
Example of exception handling when reading from a file
Exercises
Next:
Summary
Up:
All Units