public class Point { private final int x; private final int y; public Point(int x, int y) { this.x = x; this.y = y; } public Point() { this(0,0); //calls sibling constructor } public Point reflectionAcrossX() { return new Point(x, -y); } @Override public String toString() { return String.format("(%s, %s)", x, y); } @Override public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Point)) { return false; } //o must be a Point! Point that = (Point) o; return x == that.x && y == that.y; } public double distanceTo(Point that) { return Math.hypot(x - that.x, y - that.y); } }