One of the correct answers from OCP Java SE 6 Programmer Practice Exams is:
You can programmatically test wheather assertions have been enabled without throwing an
AssertionError
.
How can I do that?
I use this
boolean assertOn = false;
// *assigns* true if assertions are on.
assert assertOn = true;
I am not sure this is the "official" way.