A Program with Assertions : Assert « Language Basics « Java






A Program with Assertions

  


public class Main {
  public static void main(String[] args) {
    assert args.length > 0;
  }
}

   
    
  








Related examples in the same category

1.Enabling Assertions from the Command Line: -ea and -da enable and disable assertion in a package subtree or in a class.
2.Handling an Assertion Error
3.Catch assert exception with message
4.Assert with an informative message
5.Non-informative style of assert
6.Using the class loader to enable assertions
7.Class for checking syntax and comments for the assert
8.Assert Util
9.Assertion utility class that assists in validating arguments.
10.An assertion utility just for simple checks.