...
Exceptions are convenient in many ways for handling errors and special conditions in a program. When we think that a code segment exists which can produce an error then we can use exception handling.
Example
The following example asks the user for input until a valid integer has been entered.
...