Java 23456543 W 2

You might also like

You are on page 1of 1

1. The NullPointerException is an example of a ___________ exception.

Answer: runtime

2. The ArithmeticException is thrown when ___________ occurs.

Answer: arithmetic error (e.g., division by zero)

3. The FileNotFoundException is an example of a ___________ exception.

Answer: checked

4. The RuntimeException class is a subclass of ___________.

Answer: Exception

5. The Error class in Java represents ___________ errors that typically cannot be
recovered from.

Answer: serious

6. A try block must be followed by ___________ or both catch and finally blocks.

Answer: catch

7. The throw keyword is used to ___________ an exception manually within a


method.

Answer: throw

8. An IOException is an example of a ___________ exception.

Answer: checked

9. A custom exception class should generally extend from ___________ or one of


its subclasses.

Answer: Exception

10. The purpose of exception handling in Java is to ___________ unexpected errors


gracefully and prevent program crashes.

Answer: handle

You might also like