Java exception

 

 

1 The reason for the exception:

 



 

 

 

2 Processing method after exception occurs:

 



 

 

3 Anomaly classification:

 

The Error class does not need programmers to deal with. When driving, the engine is broken, and the driver can't control it is the manufacturer's business.

Exception class When there are obstacles or people on the highway, the driver needs to stop.



 

 Extended explanation of the above figure:

The Error class does not need programmers to deal with. When driving, the engine is broken, and the driver can't control it is the manufacturer's business.

Exception class When there is an obstacle or a person on the highway, the driver sees a big stone (jre catches an exception) The driver stops the process

 

 

Throwable

   Error

   Exception

     CheckedException ----" The code must catch the exception, that is, it must be wrapped in try cath check checked past tense: checked by the compiler 

     RuntimeException

UncheckedException ----" The compiler did not check directly, because this kind of exception is too frequent eg int i = 1/0;

Example: Driving at high speed and the road is broken, then you must stop and deal with it----" checkedexcption

       Driving at high speed, there are other cars in front, you need to keep either overtaking or following, very frequently ----> uncheckedexception ----> jre will automatically new the corresponding exception object, capture it for processing

 

74

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326674325&siteId=291194637