Page 634 - Introduction to Programming with Java: A Problem Solving Approach
P. 634

                600 Chapter 14 Exception Handling
5. False. After executing the catch block, the JVM continues downward; it does not jump back to the try
block. Consequently, try-block statements get skipped if they follow an exception-throwing statement.
6. True.
7. If an exception is derived from the RuntimeException class, it is an unchecked exception.
8. Checked exceptions are exceptions that are in or derived from the Exception class, but not in or derived
from the RuntimeException class.
9. Viable options for an unchecked exception that you know might be thrown: a) Not viable! You don’t want your program to crash at runtime.
b) Viable.
c) Viable.
10. True.
11. True. If the statement contains a checked exception, the compiler will say so and identify the exception
type.
12. Yes.
13. The Exception exception.
14. The Exception class’s getMessage method returns a text description of the thrown exception.
15. False. You can use a generic catch block to catch different kinds of exceptions.
16. True. The compiler complains if an earlier more generic catch block preempts a later more specific
   catch block.
Apago PDF Enhancer
17. The two types of information displayed by the JVM when it encounters a runtime error are:
a) Identification of the particular exception thrown.
b) A call-stack trace, which is a reverse-order listing of the methods called just prior to the crash, along
with the line numbers where the error occurred in each method.
18. You must append throws NumberFormatException to the end of the method heading.
19. No. When an exception is thrown back to the calling method, the JVM does not return a value (with a return statement) to the calling module.









































































   632   633   634   635   636