1. First look at the relationship between classes
2. What Error and RuntimeException have in common
Both Error and RuntimeException are unchecked exceptions (unchecked)
Unchecked exception:
The response is a program logic error,
such as
an array out of bounds exception ArrayIndexOutOfBoundsException
except 0 exception
ArithmeticException
. The compiler will notThrow or mandateResolve the exception.
In other words, the code can pass the check of the compiler
Checkable anomalies
Checkable exceptions are those that frequently occur in a program and
need to be thrown or recaptured
3. The difference between Error and RuntimeException
Error error is a very serious error, generally thrown by the JVM. The
application generally does not throw this exception. It is
usually a resource exhaustion, a problem with the bytecode check, etc.
RumtimeException is Exception is a runtime exception
This exception can be resolved manually