The assert
statement is a convenient mechanism for incorporating diagnostic tests in code. The behavior of the assert
statement depends on the status of a runtime property. When enabled, the assert
statement evaluates its expression argument and throws an AssertionError
if false. When disabled, assert
is defined to be a no-op; any side effects resulting from evaluation of the expression in the assertion are lost when assertions are disabled. Consequently, expressions used with the standard assert
statement must not produce side effects.
...