Exception handling
A throw stamement is similar to...
a method call.
RuntimeException and its sub-classes
be caught by the catch block
Whenever an exception is thrown, it should ultimately be handled (or caught) by
catch block
The classes Throwable, Exception, and all descendants of the class Exception are ____________.
checked exceptions.
Error class
class that can catch all exceptions which cannot be caught
finally block
contains code to be executed whether or not an exception is thrown in a try block.
Nested try-catch blocks
different names must be used for the catch block parameters in the inner and outer blocks.
The class Error and all its descendant classes are called ________.
error classes
A throw statement can throw an
exception object of any exception class
The class Exception is in the. _______ , and so requires no ______
java.lang package, import statement
throw
keyword that is used to manually throw an exception
try
keyword that must be used to monitor for exceptions
Catch block parameter
names the value type, and names the value caught
getMessage returns the string
that is passed to its constructor as an argument
In exception handling
the event objects are the exception objects
The catch block parameter does two things:
1. It specifies the type of thrown exception object that the catch block can catch 2. It provides a name (for the thrown object that is caught) on which it can operate in the catch block
Predefined exception classes have the following properties:
1. There is a constructor that takes a single argument of type String 2. The class has an accessor method getMessage that can recover the string given as an argument to the constructor when the exception object was created
Rethrowing an Exception
A catch block can contain code that throws an exception
Catch block
A segment of code that can handle an exception that might be thrown by the try block that precedes it.
Finally and catch
A single try block can be followed by......
multiple catch blocks
A try block can be followed by ________________
Error classes are not subject to the ______________.
Catch or Declare rule
Checked exceptions must follow the _______________.
Catch or Declare rule.
Unchecked exceptions are exempt from the
Catch or Declare rule.
Try block
Contains the code for the basic algorithm. It can also contain code that throws an exception if something unusual happens.
an exception handler
Each catch clause that follows a try block is called:
Exception handling is an example of....
Event-driven programming
A catch block looks like a method definition that has a parameter of type
Exception class
Constructors are the most important members to define in an _________
Exception class
Run Time
Exceptions in Java arises in code sequence
checked exceptions
Exceptions that are subject to the catch or declare rule are called
default handler
Handles the exception when catch is not used
throws clause
If a method can throw an exception but does not catch it, it must provide a warning that is called.... In other words, is the keyword use for handling checked exceptions.
Throwable class
Is a super class of all errors and exceptions in the Java language
java.util.InputMismatchException
It is a descendent class of RuntimeException
getMessage()
Methods that return description of an exception
Event-driven programming
Objects are defined so that they send events to other objects that handle the events
firing an event
Sending an event
Throwing an exception
Some library software or your code provides a mechanism that signals when something unusual happens. Is the execution of the throw statement.
Throwable class
The built-in base class in Java, which is used to handle all exception
When an exception is thrown
The catch block beings execution
catching the exception
The execution of the catch block is called...
order of multiple catch blocks
The first one that matches the type of the exception thrown is the one that is executed
Declaring Exceptions
The process of including an exception class in a throws clause
Handling Exceptions
The programmer must provide code that deals with the exceptional case
Exception handler
This is a section of code that gracefully responds to exceptions. Often referred as the catch block.
Every exception class is a descendent class of the class
Throwable
Is the order of catch blocks important when catching multiple exceptions?
True