JAVA Chpt 11
All of the exceptions you will handle are instances of classes that extend the __________ class.
Exception
Which of the following statements is true?
The code in a finally is executed whether an exception is handled or not.
What happens if a program does not handle an unchecked exception?
The program is halted and the default exception handler handles the exception
All exceptions are instances of classes that extend the __________ class.
Throwable
Chained exceptions are useful for finding out about ________.
an original exception that was caught before the current exception was thrown
Which of the following are types of assertions?
control proceeds to the first statement after the finally block
A new exception class must directly extend the Exception class.
false
The throw statement informs the compiler that a method throws one or more exceptions.
false
When handling exceptions, you can use a [fillIn1] reference as a [fillIn2] in the catch clause. [fillIn3] means to take on many forms that in OOP is the result of [fillIn4] where one class is related to another class. True or False: A parent/superclass reference variable can be used in referencing their children/subclass objects. [fillIn5]
fillin1: polymorphic fillin2: parameter fillin3: Polymorphism fillin4: inheritance fillin5: True
Code can be written to throw [fillIn1] or [fillIn2]. The throw statement is used to [fillIn3] throw an exception. Insert Format: [fillIn4] Code a throw statement with this message: "No such employee!" Insert Code: [fillIn5]
fillin1: standard Java exceptions fillin2: custom exceptions fillin3: manually fillin4: throw new ExceptionType(MessageString); fillin5: throw new Exception("No such employee!");
In a catch requirement, the code that generates the exception must be wrapped in a [fillIn1] block and must provide a [fillIn2] handler for the checked-exception type (or one of its superclasses). In a declare requirement, the method must provide a [fillIn3] clause containing the checked-exception type after its parameter list and before its method body.
fillin1: try fillin2: catch fillin3: throws
When you write a method that throws a checked exception, you must
have a throws clause in the method header
When an exception occurs, it is said to have been ________.
thrown
The ability to catch multiple types of exceptions with a single catch clause is known as multi-catch and was introduced in Java 7.
true