exception java
The IllegalArgumentException class is derived from the RuntimeException class, and is therefore
An unchecked exception class
System error = error thrown by
JVM
____ is an abstract class that all the other character stream-reading classes are derived from.
Reader
unchecked exception
Runtime exceptions and error
Exception classes is three main categories
System errors, excpetions, rt exception
Every method must state the type of checked exceptions it might throw
T
If a method does not handle a possible exception, what must the method have?
A throws clause in its header
Detecting of an error is in .... and handling of an error is done in..
Called method, calling method
Throws to.. and throw to..
Declare an exception,throw an excpetion
A(n) ____ is an object that is generated in memory as the result of an error or an unexpected event.
Exception
All of the exceptions that you will handle are instances of classes that are derived from
Exception
Exception is an instance of
Exception class java.lang.ArithmeticException ex
A(n) ____ is a section of code that gracefully responds to exceptions when they are thrown.
Exception handler
True/False A catch clause that uses a parameter variable of the Exception type is capable of catching any exception that is derived from the Error class.
F
True/False The throws clause causes an exception to be thrown.
False,
Classes that are derived from the Error class are
For exceptions that are thrown when a critical error occurs, and the application program should not try to handle them
The following catch statement can catch (Exception e) {...}
Handle all exceptions by using polymorphic reference as a parameter in the catch clause
If, within one try statement you want to have catch clauses of the following types, in which order should they appear in your program:
IllegalArgumentException/RuntimeException/Exception/Throwable
When an exception is thrown,
It must be handled by the program or by the default exception handler
System.out.println(e.getMessage());
It prints the default error message for an exception
True/False The call stack is an internal list of all the methods that are currently executing.
T
True/False When the code in a try block may throw more than one type of exception, you need to write a catch clause for each type of exception that could potentially be thrown.
T
Unchecked exceptions are those that inherit from
The Error class or the RuntimeException class
checked exception
The compiler forces the programmer to check and deal with them in try-catch
If the program does not handle an exception,
The program is halted and the default exception handler handles the exception
In a try/catch construct, after the catch statement is executed
The program resumes at the statement that immediately follows the try/catch construct
True/False When an exception is thrown by a method that is executing under several layers of method calls, a stack trace indicates the method executing when an exception occurred and all of the methods that were called in order go execute that method.
True
If the code in a method can potentially throw a checked exception, then that method must
handle the exception/has a throw clause in header of the method
The root class for excpetions
java.lang.Throwable