Below is the organization of Java exception classes. The red area represents the exception classes that the program needs to display to catch or throw.
Throwable
Throwable is the top-level Java exception class from which all exceptions are inherited.
Error, Exception are two large categories of Exception classes.
Error
Error is a non-program exception, that is, an exception that cannot be caught by the program. Generally, it is a compilation or systematic Error, such as OutOfMemorry memory overflow exception.
Exception
Exception is a program Exception class that is generated internally by the program. Exception is classified into runtime Exception and non-runtime Exception.
Runtime exception
The characteristic of a runtime exception is that the Java compiler does not check for it. That is, when such an exception may occur in a program, it will be compiled even if it is not caught by a try-catch statement or thrown without a throws clause declaration. The runtime exception may or may not be handled. Runtime exceptions are usually defined as custom exceptions of the system, and services handle them differently according to custom exceptions.
Common run-time exceptions such as NullPointException and ArrayIndexOutOfBoundsException, etc.
Non-runtime exception
A non-runtime exception is an exception that a program must handle, catch, or throw, without which the program will not compile. Such as common IOException, ClassNotFoundException, etc.
Recommended reading
Dry goods: 2TB architect four-stage video tutorial
Interview: the most complete Java multithreaded interview questions and answers
Interview: the most comprehensive ali advanced Java interview questions in history
Interview: The most complete Spring interview questions in history
Tutorial: The most complete Spring Boot complete video tutorial
Books: 15 must-read books for advanced Java architects
Tools: Recommended an online creation flow chart, mind mapping software
Share Java dry goods, high concurrency programming, hot technology tutorials, microservices and distributed technology, architecture design, blockchain technology, artificial intelligence, big data, Java interview questions, and cutting-edge hot news.