The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.lang  [58 examples] > Assertions  [3 examples]

e103. Compiling a Program with Assertions

To compile a program with assertions, you must add the command line option -source 1.4 to javac.
    public class CompileAssert {
        public static void main(String[] args) {
            assert args.length > 0;
        }
    }
This is the command to compile the program:
    >javac -source 1.4 CompileAssert.java

 Related Examples
e104. Enabling Assertions from the Command Line
e105. Handling an Assertion Error

See also: Arrays    Classes    Commands    Numbers    Objects    Strings    System Properties    Threads   


© 2002 Addison-Wesley.