Chapter 11 Exception and Advance File I/O (Review)
18. True or False: When an exception is thrown by code inside a try block, all of the statements in the try block are alway executed.
False
24. True or False: The throws clause causes an exception to be thrown.
False
5. FileNotFoundException inherits from __________.
IOException
8. The numeric wrapper classes' "parse" methods all throw an exception of this type.
NumberFormatException
4. All exception classes inherit from this class.
Throwable
17. True or False: You are not required to catch exceptions that inherit from the RuntimeException class.
True
21. True or False: When an exception is thrown, the JVM searches the try statement's catch clauses from top to bottom and passes control of the program to the first catch clause with a parameter that is compatible with the exception.
True
22. True or False: Not including polymorphic references, a try statement may have only one catch clause for each specific type of exception.
True
10. This is an internal list of all the methods that are currently executing
call stack
You _____ have more than one catch clause per exception type in the same try statement.
cannot
13. All exceptions that do not inherit from the Error class or the RuntimeException class are __________
checked exceptions
3. If your code does not handle an exception when it is thrown, it is dealt with by this.
default exception handler
9. This is one or more statements that are always executed after the try block has executed and after any catch blocks have executed if an exception was thrown.
finally block
In a custom exception class, If you do not pass an error message to the superclass's constructor, the exception object will have a_____ error message.
null
11. This method may be called from any exception object, and it shows the chain of methods that were called when the exception was thrown
printStackTrace
If you are handling multiple exceptions in the same try statement, and some of the exceptions are related to each other through inheritance, then you should handle the more specialized exception classes before the more general exception classes. Otherwise, an error will occur because the compiler thinks that you are handling the ____ ____more than once.
same exception
15. You use this statement to throw an exception manually
throw
1. When an exception is generated, it is said to have been __________.
thrown
14. This informs the compiler of the exceptions that could get thrown from a method.
throws clause
If a method is capable of throwing a checked exception but does not handle the exception, it must have a ____ _____ in its header that specifies the exception.
throws clause
You must either handle all of the checked exceptions that a method can throw, or list them in the calling method's _________.
throws clause
6. You can think of this code as being "protected" because the application will not halt if it throws an exception.
try block
In a try statement, the ____ clause must appear first, followed by all of the ____ clauses, followed by the optional ______ clause.
try, catch, finally
12. These are exceptions that inherit from the Error class or the RuntimeException class.
unchecked exceptions
19. True or False: IOException serves as a superclass for exceptions that are related to programming errors, such as an out-of-bounds array subscript
False
20. True or False: You cannot have more than one catch clause per try statement.
False
23. True or False: When in the same try statement you are handling multiple exceptions and some of the exceptions are related to each other through inheritance, you should handle the more general exception classes before the more specialized exception classes.
False
If a class has fields that are objects of other classes, those classes must implement the ________ interface in order to be serialized.
Serializable
16. This is the process of converting an object to a series of bytes that represent the object's data.
Serialization
2. This is a section of code that gracefully responds to exceptions.
exception handler
When an exception is thrown, the try block is exited immediately. This means that statements appearing in the try block after the offending statement will not be _______.
executed
7. This method can be used to retrieve the error message from an exception object.
getMessage