Exception vs error
An exception indicates a condition from which a program can recover and it might be a good idea to recover from such exception programmatically while in case of error, the programmer is not required to do anything because there is no way for the application program to recover from that error.
Below is the list of few differences between Errors and Exceptions classes.
|Errors in java are the objects of java.lang.Error classes.||Exceptions in java are the object of java.lang.Exception classes.|
|All error in java are of unchecked type.||Exception include both checked and unchecked type.|
|Error are not catch by compiler as it happens at run time only.||Checked expception are catch by complier where as unchecked exception are not catch by the complier as it happen at run time.|
|Errors are basically occures due to the environment.||Exception are mainly occurs due to the application only.|
|It is impossible to recover from errors.||We can recover by exception by handling with exception handling keywords.|