Chapter 7 Knowledge Points


  (1) Exceptions are non-serious errors thrown and handled by java applications, which can be divided into two categories: Checked exceptions and running exceptions

  (2) Cheked exceptions must be caught or declared to be thrown, otherwise they cannot be compiled. Runtime exceptions are not required to be caught or
       declared to be thrown.
  (3) Java's exception handling is achieved through five keywords: try, catch, finally, throw and throws.
  (4) Even if there is a return statement in the try block and catch block, the statement in the finally block will be executed. The only case where statements in a finally block are not
       executed is when System.exit() is executed in exception handling code.
  (5) A try statement block can be followed by multiple catch statement blocks to handle different exceptions respectively. But the sorting order must be from special to general, and the last one is generally Exception class.
  (6) Custom exception classes generally need to inherit Exception or RuntimeException.
  (7) log4j is an excellent logging tool. The commonly used method is to configure the lo4j.properties file to control the output level, destination and output format of the log.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325906774&siteId=291194637