Using the class loader to enable assertions : Assert « Language Basics « Java

Using the class loader to enable assertions

// :
//Using the class loader to enable assertions
//Compile with: javac -source 1.4
//From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// See copyright notice in CopyRight.txt.

public class LoaderAssertions {
  public static void main(String[] args) {
    new Loaded().go();

class Loaded {
  public void go() {
    assert false: "Loaded.go()";


Related examples in the same category

1.A Program with Assertions
2.Enabling Assertions from the Command Line: -ea and -da enable and disable assertion in a package subtree or in a class.
3.Handling an Assertion Error
4.Catch assert exception with message
5.Assert with an informative message
6.Non-informative style of assert
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.