How to exception handling in Java? Throws, throw, try, catch, finally, respectively, how to use?

  • The classification of the various anomalies
  • Each exception is an object that is an instance of a subclass of Throwable or
  • One way to throw an exception after exception occurs object that contains exception information, call the object's method can capture this exception handling
  • Java Exception handling is achieved by five Keywords: throw, throws, try, catch and finally

    When the definition method can be used keyword throws an exception is thrown
    in vivo method using the throw thrown
    using a try implementation of a code, when the abnormality occurs, stops executing the subsequent code, jump catch block
    used to capture the catch specified exception and processed
    finally block semantics are represented in the try, the end of the catch block executed, will be executed last


Description link
 


 

 

Guess you like

Origin www.cnblogs.com/ConstXiong/p/12175128.html