52. Benefits of Exception handling

By | September 27, 2021

the benefits of exception handling are as follows, 

(a) Exception handling can control run tune errors that occur in the program. 
(b) It can avoid abnormal termination of the program and also shows the behavior of program to users. 
(c) It can provide a facility to handle exceptions, throws message regarding exception and completes the execution of program by catching the exception 
(d) It can separate the error handling code and normal code by using try-catch block.
(e) It can produce the normal execution flow for a program. 
(f) It can implement a clean way to propagate error. that is. when an invoking method cannot manage a particular situations, then it throws an exception and asks the invoking method to deal with such situation. 
(g) It develops a powerful coding which ensures that the exceptions can be prevented. 
(h) It also allows to handle related exceptions by single exception handler. All the related errors are grouped together by using exceptions. And then they are handled by using single exception handler. 
(i) Separation of annual code from error handling code eliminates the need for checking the errors in normal execution path there decreasing the cycles. 
(j) A failed constructor can also be handled by throwing an exception. The code for try, catch and throw blocks must be written in the constructor itself. 

Leave a Reply

Your email address will not be published. Required fields are marked *