Java provides two types of exception classes, error and exception, which have a common parent class-throwable.
Error indicates that the program has made a very serious error during the run and that the error is not recoverable, such as OutOfMemoryError, Threaddeath, etc.
Exception represents an exception that can be recovered, which the compiler can capture. Consists of two types:
Check for exceptions and Run-time exceptions.
1) Check for exceptions. The Java compiler enforces programs to catch such exceptions, such as IO Exceptions and SQL exceptions.
2 run-time exception. The compiler does not force it to be caught and processed. If no processing occurs, the JVM will handle the exception.
A run-time exception occurs, and the system throws the exception up until the process code is encountered. If no code is processed, it is thrown to the top.
Multithreading and Thread.run () methods are thrown, single-threaded with the main () method. If an exception is not handled, either the thread terminates or the main program terminates once it occurs.
Runtime exceptions include: Nullpointexception (null-pointer exception)
ClassCastException (type conversion exception)
ArrayIndexOutOfBoundsException (array out of bounds exception)
Arraystoreexception (Array store exception)
Bufferoverflowexception (buffer overflow exception)
ArithmeticException (calculation of abnormal transmission)