Java SE 8 Programmer I — Question 68
Which three are advantages of the Java exception mechanism? (Choose three.)
Answer options
- A. Improves the program structure because the error handling code is separated from the normal program function
- B. Provides a set of standard exceptions that covers all possible errors
- C. Improves the program structure because the programmer can choose where to handle exceptions
- D. Improves the program structure because exceptions must be handled in the method in which they occurred
- E. Allows the creation of new exceptions that are customized to the particular program being created
Correct answer: A, C, E
Explanation
The correct answers A, C, and E highlight the benefits of separation of error handling, flexibility in managing exceptions, and the ability to create custom exceptions. Option B is incorrect as it suggests that a complete set of standard exceptions exists for all errors, which is not true. Option D is also incorrect because it implies that exceptions must be handled in the same method, which contradicts the flexibility that Java's exception mechanism provides.