Java: An Introduction to Problem Solving and Programming (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 9.1, Problem 3STQ

Explanation of Solution

Exception:

  • • It is nothing but an undesirable or unexpected event that occurs at run time which interrupts the normal flow of the program’s commands.
  • • Exception handling is a mechanism that handle runtime errors like “ClassNotFoundException”, “SQLException”, and so on.
  • • An advantage of exception handling is to maintain a flow of the program.
  • • An exception can be handled using “try” and “catch” block.

Types of exceptions:

There are two types of exceptions. They are:

  • Checked Exception:
    • ○ A class that inherits a “Throwable” class except “RunTimeException” and “Error” are called as checked exceptions.
    • Example:“IOException”
  • Unchecked Exception:
    • ○ A class that inherits a “RunTimeException” class is called as unchecked exceptions.
    • Example:“ArrayIndexOutOfBoundException”

Exception is an object: The exception is considered as an object because, the exception creates an object that contains a message...

Blurred answer
Students have asked these similar questions
Define the Exception Classes? what are the characteristics of these classes?
Error handling and the identification and management of exceptions is given so much attention. Is there a point at which the expense exceeds the benefits?
What components make up a class from which someone is an exception?

Chapter 9 Solutions

Java: An Introduction to Problem Solving and Programming (8th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning