Which of the following is not an advantage of java exception handling?

1. Which of the following is not an advantage of exception handling? A. Exception handling improves code organization by separating a method’s error handling code from method’s body. B. Exception handling allows a method to defer the handling of its errors to a previously called method. C. Exception handling improves an application’s performance. D. Exception handling allows similar errors to be handled by a single handler.

Answer

Answer: Correct Option: B. Exception handling allows a method to defer the handling of its errors to a previously called method. Explanation: In exception handling, all the exceptions of a method should be handled by the method itself. Exception handling does not provide any way to defer the handling of the error to any other method. Hence, option B is not an advantage of exception handling and hence it is the correct option. Remaining Options: Option A: There is the proper syntax of writing code for exception handling which makes error handling code separate from the method body. Hence, Exception handling improves code organization by separating a method’s error handling code from the method’s body. Option C: An exception handling can be used to handle multiple kinds of runtime errors which saves the application from crashing and other similar issues which leads to improvement in the performance of the application. Hence, Exception handling improves an application’s performance. Option D: Similar exceptions can be handled by a single handler in exception handling. For example: ArithmeticException can handle all the exceptions that occurred due to Arithmetic operations. Hence, Exception handling allows similar errors to be handled by a single handler. As these options are an advantage of exception handling, these options are incorrect. I hope you got the provided solution. Please do comment if need any help regarding this solution.

Thank You.

Leave a Comment