You can use assertions to detect errors that may otherwise go unnoticed.您可以使用断言来侦测错误,否则可能被遗漏的地方。 Assertions contain Boolean expressions that define the correct state of your program at specific points in the program source code.断言包含布尔表达式,界定正确的状态,您的程序在特定的点,在该计划中的源代码。 The designers of the Java platform, however, didn’t include support for assertions.设计者在Java平台上,不过,并不包括支持的断言。 Perhaps they viewed exceptions as a superior feature, allowing you to use try/catch/finally to throw an exception instead of aborting the program as in assertions.也许他们认为,作为一个例外优势功能,让您使用尝试/赶上/最后抛出一个例外而不是中止计划在断言。 But the Java 2 Platform, Standard Edition (J2SE) release 1.4, has introduced a built-in assertion facility.但Java 2平台标准版( J2SE )发布1.4 ,推出了内置在断言设施。 This article does the following:本文以下内容:

* Presents an overview of design by contract *介绍概述了设计合同
* Presents an overview of assertions *介绍概述了断言
* Shows how to roll your own assertion capabilities *说明如何辊自己的断言能力
* Describes the new assertion facility *介绍了新的断言设施
* Shows how to use the new assertion facility *说明如何使用新的断言设施
* Offers guidelines for using assertions *提供指引,使用断言
* Presents examples of how to use assertions *介绍的例子,如何使用断言

Read the阅读 article here文章在这里 ; highly recommended. ;强烈建议。