Development Java Tutorial

public class MainClass {
  public static void main(String[] arg) {
    int a = 0;
    assert a == 0;
  }
}
java -enableassertions MyProg
You can also use its abbreviated form -ea:
java -ea MyProg