> assert statement java ~ Online tutorial

assert statement java

The assert Statement
An assertion is a statement containing a boolean expression. An assertion is either
enabled or disabled. If the assertion is enabled, evaluation of the assertion causes
evaluation of the boolean expression and an error is reported if the expression
evaluates to false. If the assertion is disabled, evaluation of the assertion has no
effect whatsoever.

AssertStatement:
assert Expression1 ;
assert Expression1 : Expression2 ;


1)It is a compile-time error if Expression1 does not have type boolean or Boolean.
2)In the second form of the assert statement, it is a compile-time error if
Expression2 is void .
3)Assertions may be enabled or disabled on a per-class basis. At the time a class
is initialized , prior to the execution of any field initializers for class variables
and static initializers , the class’s class loader determines
4)whether assertions are enabled or disabled as described below. Once a class has
been initialized, its assertion status (enabled or disabled) does not change.

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: