Java Exceptions and Errors
There is a trade-off between correctness and clarity :
- Correctness, checking for errors,
- Clarity, a clear and readable basic flow of the code.
Exceptions are a clean way to manage abnormal states.
Exception : mild error which you can handle.
Error : serious error -> termination.
The idea is to signal exceptions to the current running process announcing that a problem has occurred.
An exception is thrown and then caught.