Anomalies are different from normal, and they are not the same, and errors occur. An issue that blocks the execution of the current method or scope, called an exception.
All classes in Java that are related to exceptions inherit from the Throwable class, the Throwable class has two sons, one is the error class, and the other is the exception class.
The error class exception includes a virtual machine error, thread deadlock, and so on, the error occurs, and the program crashes completely.
Exception abnormal appearance, indicating that there are problems in the program, may be encoding, environment, user operation input and other causes of the exception, exception has a lot of sons, common for RuntimeException (runtime exception), there are other exceptions. RuntimeException is a non-check exception, while other exceptions are check exceptions.
There are many situations that cause runtimeexception anomalies, such as the property fire method that references an empty object, the array access bounds, the wrong type conversion, and the exception caused by arithmetic (for example, except 0). The above four cases correspond to null pointer exception (nullpointerexception), array subscript out-of-bounds exception (arrayindexoutofboundsexception), Type conversion exceptions (classcastexception) and arithmetic exceptions (ArithmeticException), and, of course, many other run-time exceptions, which are subclasses of RuntimeException, are not described here.
Runtime exceptions are automatically thrown by the Java virtual machine and automatically captured, while the run-time exception occurs in most cases where the name code itself is problematic and should logically improve the code
Check for exceptions, the cause of the inspection anomalies may be a variety of wonderful reasons, such as file exceptions (IOException), SQL Exception (SQLException), and so on, unlike RuntimeException, You need to manually add captures and process statements for checking exceptions
Introduction to Java Exceptions