/** * CSE 331 16sp section 3 * checkRep demo. */ class Point { double x, y; public Point(double x, double y) { this.x = x; this.y = y; } } class Circle { private Point center; private double radius; public Circle(Point center, double radius) { this.center = center; this.radius = radius; checkRep(); } public void checkRep() { assert this.center != null; assert this.radius > 0; } } public class CheckRepDemo { public static void main(String[] args) { // create a new circle new Circle(new Point(1, 1), 10); // create an invalid circle Point p = null; new Circle(p, 10); // create another invalid circle new Circle(new Point(1, 1), -44.22323); System.out.println("All good to go!"); } }