Java 编程语言采用 exceptions 来处理错误和其他异常事件。本课程将介绍什么时候以及怎样使用 exceptions 。
异常是什么?
异常发生在于程序执行期间,An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.
The Catch or Specify Requirement
This section covers how to catch and handle exceptions. The discussion includes the try, catch, and finally blocks, as well as chained exceptions and logging.
怎样抛出异常?
本节包括 throw 申明语句和 Throwable 类以及子类。
The try-with-resources Statement
This section describes the try-with-resources statement, which is a try statement that declares one or more resources. A resource is as an object that must be closed after the program is finished with it. The try-with-resources statement ensures that each resource is closed at the end of the statement.
Unchecked Exceptions — The Controversy
This section explains the correct and incorrect use of the unchecked exceptions indicated by subclasses of RuntimeException.
Exceptions 的好处
采用 exceptions 去管理错误相对于传统的错误管理技术来说有诸多好处。你将在本课程中学到这些。
网友评论