Exception Handling Flashcards
(27 cards)
An ____ is an ____or unexpected ____ that happens while the program is running.
exception, error, situation
What are the common Causes of Exception Handling
- The program asks for input, but the user enters the wrong type of data (e.g., text instead of a number).
- The program tries to divide a number by
zero, which is not allowed in math. - The program accesses an array index that doesn’t exist (e.g., using a negative index or going beyond the last element).
Why are they called “Exceptions”?
They are unusual cases, or
“exceptions” to the usual process.
________ refers to techniques that Java uses to ____, ____, and respond to _____ in a controlled way.
Exception handling, detect, handle, errors.
Exception Handling uses ________ concepts to manage these problems.
object-oriented programming (OOP)
A ________ happens while the program is running.
runtime exception
A ______ is a mistake in the code structure, like missing a semicolon, and is found _____ the program runs (during compilation).
syntax error, before
What are the two types of main classes Java handles?
Exception and Error
Both of these classes come from a ______ called _______, and like all Java classes, they also come from the base class ______.
parent class, Throwable, Object
This represents serious system-level problems. These are issues that the program cannot fix by itself.
Error Class
This represents serious system-level problems. These are issues that the program cannot fix by itself.
Exception Class
What happens when a Java program could have avoided a problem but didn’t?
Java throws an Exception and displays an error message.
What does Java do if a program tries to divide by zero?
Java throws an ArithmeticException.
How many categories of Exceptions does Java acknowledges?
More than 75 exceptions
What Is a Crash in Programming?
A crash means that the program stops running suddenly because of an error.
What happens when a program crashes?
User will see an error message and the program will stop before completing its task
A list of method calls shown in the error message is called a _______.
stack trace
A _____ means that the program ________ because of an _____.
crash, stops running suddenly, error
This shows the sequence of method calls that led to the error.
stack trace
The term originally referred to physical problems with hard drives but now applies to software errors too.
Crash
This helps programmers locate and understand where the problem happened.
stack trace
What kind of program keeps running even if something goes wrong, possibly reducing performance or features without crashing?
fault-tolerant program
What kind of program can handle unexpected problems and remain more reliable under stress or errors?
robust program
With _______ makes your program safer, smarter, and user-friendly.
Exception handling