Skip to content

assertion

Keyhan Hadjari edited this page Sep 3, 2016 · 1 revision
  • If a Java class contains assert statements, then it must be compiled with -source 1.4 option.
  • When a program having assert is run, -ea or -enableassertion option must be specified, otherwise the assertions get ignored.
  • If the logical expression evaluates to false, then the program generates an AssertionError
  • The program terminates on its first AssertionError.
  • The condition in assert statement must be followed by a semi-colon.

Clone this wiki locally