Abnormal:
The exception that occurs when a Java program is Running.
How Java handles Exceptions.
try{
Where the anomaly may have occurred
}catch (exception type Object) {
Exception Handling Office
}catch (exception type Object) {
}......finally{
Whether or not an exception will be Executed. Close the Resource.
}
The exception type range for the following catch must not be less than the range of the above catch exception type.
Common exceptions, and how to exclude some common exceptions.
arithmeticexception: Arithmetic exception example: operation encountered 10/0 is
numberformatexception: Format Conversion Exception example: when a string type is converted to a numeric type
arrayindexoutofboundexception: Array subscript is out of bounds. Example: exceeding the array length
nullpointerexception: null pointer exception. Example: Object. method (); at this point, if the object is a null, the runtime produces a null pointer Exception.
classcastexception: class conversion Exception. Example: when a parent class object is transitioning Down.
The parent class of the exception class.
Throwable:
Exception: Exception class. Programmers can handle
error : Wrong class. Memory Overflow. The programmer cannot handle it.
throws Keywords
Public return value type method name (argument List) throws Exception class name {}
Indicates that this method does not handle the exception and is processed at the call of the Method.
the throw keyword directly throws the resulting exception object.
Java Basic Note 11