Loading video...
Exception Handling
- An error that arises through mistakes in coding or through incorrect data entered by the user is called an exception
- Such errors that are encountered while a program runs are said to be thrown
- Programmers try to anticipate these errors and either prevent or solve them before they happen
- Java uses the Try... Catch... process in order to try running a block of code to test for errors and then catch an error if it occurs
- All Try statements must be followed by at least one Catch statement or a Finally statement
- Exceptions that occur that are not handled by a Catch block of code or a Finally block will cause a program to terminate
Exception Handling
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.
- Intro
- What is Exception Handling?
- Why Account for Errors?
- Common Types of Errors
- Using the 'Try… Catch' Process
- Try… Catch Syntax
- Uncaught Exceptions
- Throw' Statement
- Example 1: Program to Catch Divide by Zero Error
- Example 2: Program to Demonstrate Finally Keyword
- Example 3: Superclass and Subclass Exceptions


































Start Learning Now
Our free lessons will get you started (Flash® 10 required).
Sign up for Educator.comGet immediate access to our entire library.
Features Overview