异常体系(国外英文资料).docVIP

  • 4
  • 0
  • 约7.38万字
  • 约 20页
  • 2017-05-27 发布于河南
  • 举报
异常体系(国外英文资料)

异常体系(国外英文资料) Java exception architecture An exception concept and Java exception architecture Exceptions are errors that occur during program execution. This article focuses on the exception handling of the Java language. The Java language exception handling framework, It is an important manifestation of the robustness of the Java language. Java handles exceptions as objects, and defines a base class java.lang.throwable as all exception superclasses. Many Exception classes have been defined in the Java API, which fall into two categories, Error errors and Exception exceptions. Figure 1 Java exception architecture The Thorwable class has all the exceptions and the wrong superclass, which has two subclasses Error and Exception, respectively, which represent errors and exceptions. The Exception class Exception is also run time Exception (RuntimeException) and non-runtime Exception, There is a big difference between these two exceptions, which is called an Unchecked Exception. Check exceptions (Checked exceptions). Here is a detailed look at the differences and links between these exceptions: 1, the Error and the Exception Error is an Error that the program cannot handle, such as OutOfMemoryError, ThreadDeath, etc. When these abnormalities occur, The Java virtual machine (JVM) typically selects a thread to terminate. Exceptions are exceptions that the program itself can handle, and this Exception is divided into two types of runtime exceptions and non-runtime exceptions. These exceptions should be handled as much as possible in the program. Runtime exceptions and non-runtime exceptions The runtime exception is the RuntimeException class and its subclass exceptions, such as NullPointerException, IndexOutOfBoundsException, etc. These exceptions are not checked exceptions, which can be either captured or not handled. These exceptions are typically caused by procedural logic errors, The program should avoid such exceptions as much as possible from a logical point of view.

文档评论(0)

1亿VIP精品文档

相关文档