Java: An Introduction to Problem Solving and Programming (7th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
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?
What is the difference between an error and exception?  Give an example of both.
Is there a catchphrase? What is the meaning of a finally clause? In an exception program, how do both catch and finally work?

Chapter 9 Solutions

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

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning