/** * CSE 331 16sp section 3 * Assertion demo. Run with and without assertions enabled */ public class PositiveInteger { private int value; public PositiveInteger(int val) { value = val; checkRep(); } private void checkRep() { assert value > 0 : "This is not a positive integer!"; } public int getValue() { return value; } public static void main(String[] args) { int val = -1; PositiveInteger x = new PositiveInteger(val); System.out.println(x.getValue()); } }