compile as: $ javac A.java
run as: $ java -ea A
the 'ea' stands for: enable assertions.
if you omit the '-ea' part then 'assert(i >= 5)' will have no effect.
However, we still have to enable (-ea) during running for the assertion to have any effect! So, I am not still sure how programmatically you can enable the assertion (if that was the question). But definitely, assertions are disabled at runtime by default
Working on my SCWCD so I can be a J2EE consultant earning millions of dollars and showing everyone I can
Joined: Dec 10, 2009
i was talking about enabling within the program and not using the command line....