Exceptions are the run time anomalies or unusual conditions that a program may encounter while executing.
Examples- division by zero, access to an array outside of its bounds, running out of memory space.
Because exceptions are outside the normal operation of a program, default action is to write out an error message and terminate the offending process.
Try block- A block of statements which may generate exceptions.
To throw an exception is to signal that exception has occurred.
To catch an exception is to transfer control to an exception handling routine (catch block), altering the normal execution flow of the program.
When try block throws the exception the program leaves the try block and enters the catch block.
Exceptions are the objects used to transmit information about the problem.
If the type of object thrown matches the arg type of catch statement then catch block is executed , else abort() function is invoked by default.
When no exception is thrown the control goes to the statement immediately after the catch block.