Java 2 SDK for Solaris Developer's Guide

Syntax

A new keyword is added to the language. Use of the assert keyword is governed by one modified production and one new production in the grammar:


StatementWithoutTrailingSubstatement:
           <All current possibilities, as per JLS,
              Section 14.4> AssertStatement          
AssertStatement:
   assert Expression1;
   assert Expression1 : Expression2; 

In both forms of the assert statement, Expression1 must be of type boolean or a compile-time error occurs.