An error that occurs due to an incorrectly written program. An instance is thrown when an assertion fails, that is, when a condition in an assert statement evaluates to false at runtime.

The assertion

"x must be positive"
assert (x>0);

has almost the same effect as this if statement

if (!x>0) {
    throw AssertionError("x must be positive");
AssertionError(String message)
  • message

    A message describing the assertion that failed. In the case of an assert statement, it is the text specified by the doc annotation.

    Certain tools interpret this message as markdown-formatted text.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Throwable
Inherited Methods
Methods inherited from: Object
Methods inherited from: Throwable