- Which class sits at the top of the exception hierarchy?
- Briefly explain how try and catch are used.
- What's wrong with this fragment?
// ...
vals[18] = 10;
catch (ArrayIndexOutOfBoundsException exc) {
// trata erro
}
Copy after login
- What happens when an exception is not caught?
- What's wrong with the following fragment?
class A extends Exception { ...
class B extends A { ...
// ...
try {
// ...
}
catch (A exc) { ... }
catch (B exc) { ... }
Copy after login
- Can an internal catch rethrow an exception for an external catch?
- The finally block is the last piece of code executed before the program has
undermine. Is this true or false? Explain your answer.
- What type of exceptions should be explicitly declared in the throws clause of
a method?
- What's wrong with this fragment?
class MyClass { // ... }
// ...
throw new MyClass();
Copy after login
- In Question 3 of the Chapter 6 Test, you created a Stack class. Add custom exceptions to your class that report stack full and stack empty conditions.
- What are three ways an exception can be thrown?
- What are the two direct subclasses of Throwable?
- What is multi-catch feature?
- Normally, code should catch Error type exceptions?
The above is the detailed content of Chapter 9 Final Tests. For more information, please follow other related articles on the PHP Chinese website!