Error indicates system-level errors and exceptions that the program does not have to handle, an internal error in the Java Runtime environment, or a hardware problem. For example: insufficient memory resources and so on. For this kind of error, the program is basically powerless, except to exit the operation has no choice, it is thrown by the Java virtual machine.
Exception (violation) indicates an exception that needs to be captured or handled by the program, which deals with problems caused by flaws in the design of the program or general problems caused by external input, which must be handled by the program.
Exception is also divided into run-time exceptions, subject to check exceptions.
A run-time exception, which represents an exception that cannot be recovered by the program, is usually caused by an incorrect operation that is recommended to terminate the program, so the compiler does not check for these exceptions.
A checked exception is an exception that indicates that the program can handle, which means that the program can be repaired (by the program itself accepting the exception and processing it), so it is called a check exception.
What is the difference between error and exception?