Specifications

Sun Services
Java™ Programming Language
Module 8, slide 20 of 25
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Assertions
Syntax of an assertion is:
assert
<boolean_expression>
;
assert
<boolean_expression>
:
<detail_expression>
;
•If<
boolean_expression
> evaluates false, then an
AssertionError is thrown.
The second argument is converted to a string and used
as descriptive text in the AssertionError message.