Java examples for Language Basics:assert
A Program to Check Whether Assertion is Enabled
public class Main { public static void main(String[] args) { boolean enabled = false; assert enabled = true; if (enabled) { System.out.println("Assertion is enabled."); }/*from ww w. jav a 2 s . co m*/ else { System.out.println("Assertion is disabled."); } } }