The parent class in the exception structure Throwable class, its exception class and the error class.
Error at the system level: An error occurred in the Java Runtime environment. Not controllable
Exception is a program-level error: controllable
GetMessage () Method: Used to get information about the abnormal time.
Printstacktrace () Method: Used to track the contents of the execution stack when an exception event occurs.
Exception exception in Java are divided into:
Non-detection exception (RuntimeException subclass), the most common running exception:
nullpointerexception/, IllegalArgumentException, classcastexception
NumberFormatException, ArrayIndexOutOfBoundsException, ArithmeticException
can detect exceptions (non-runtimeexception subclasses): Compile-time detection, except for exceptions that run at runtime,
is a detectable exception, you must declare the method with THORWS declaration of the type of exception that might be thrown!
Java Exception handling mechanism