Java exceptions can be divided into 3 types:
(1) Compile-time exception: Java.lang.Exception
(2) Run-time exception: Java.lang.RuntimeException
(3) Error: Java.lang.Error
Java.lang.Exception and Java.lang.Error inherit from Java.lang.Throwable;
Java.lang.RuntimeException inherits from Java.lang.Exception.
Compile-time Exception: The program is correct, but because the external environment conditions do not meet the trigger. For example: User error and I/O problem----program tries to open a remote socket port that does not exist. This is not a logic error for the program itself, but it is probably a remote machine name error (user spelling error). For commercial software systems, program developers must consider and address this issue. The Java compiler enforces the requirement to handle such exceptions, and if such exceptions are not caught, the program cannot be compiled.
Run-time exception: This means that there is a bug in the program, such as array out of bounds, 0 is removed, the entry parameter does not meet the specification ..... Such exceptions require a change of program to avoid, and the Java compiler enforces the requirement to handle such exceptions.
Error: Rarely seen, also difficult to solve through the program. It may originate from a bug in the program, but it is generally more likely to originate from environmental problems such as memory exhaustion. Errors do not need to be handled in the program, and there is a running environment to handle.
Java Exception &&runtimeexception exception