Exceptions and Errors in Java

Exception Exception is an exceptional case that can happen in a program An Exception occurs during the execution of a program and disrupts the normal flow of instructions. When there is an exception Normally the program crashes and prints a system generated error message Not acceptable in a mission critical application The programmer can handle the exception, preventing the program from crashing Exception Handler is a set of instructions that handles an exception The Java programming language provides a mechanism to help programs report and handle errors When an error occurs, the program throws an exception The exception object that is thrown contains information about the exception The runtime environment attempts to find the Exception Handler The exception handler attempts to recover from the error If the error is unrecoverable, provide a gentle exit from the program after clean up operations like closing open files etc Helpful in separating the… Read more“Exceptions and Errors in Java”