Advantages of Exception Handling
-> Following are the advantages of exception handling:
1. Exception handling separates the exception handling code from the main logic of program.
2. Exceptions can be handled outside of the regular code by throwing the exceptions from a function definition or by re-throwing an exception.
3. Functions can handle only the exceptions they choose i.e., a function can throw many exceptions, but may choose handle only some of them.
4. Exception handling helps programmers to create reliable systems.
*NOTE: A program with exception handling will not stop abruptly. It terminates gracefully by giving appropriate message.
-> Following are the advantages of exception handling:
1. Exception handling separates the exception handling code from the main logic of program.
2. Exceptions can be handled outside of the regular code by throwing the exceptions from a function definition or by re-throwing an exception.
3. Functions can handle only the exceptions they choose i.e., a function can throw many exceptions, but may choose handle only some of them.
4. Exception handling helps programmers to create reliable systems.
*NOTE: A program with exception handling will not stop abruptly. It terminates gracefully by giving appropriate message.