Using the class loader to enable assertions
// : c15:LoaderAssertions.java //Using the class loader to enable assertions //Compile with: javac -source 1.4 LoaderAssertions.java //{ThrowsException} //From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 //www.BruceEckel.com. See copyright notice in CopyRight.txt. public class LoaderAssertions { public static void main(String[] args) { ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true); new Loaded().go(); } } class Loaded { public void go() { assert false: "Loaded.go()"; } } ///:~