public class Point implements Cloneable { private double x = 0; private double y = 0; public Point() {} public Point(double x, double y ) { this.x = x; this.y = y; } // Cloning constructor public Point(Point p) { this.x = p.x; this.y = p.y; } public double getX () { return x; } public double getY () { return y; } public boolean equals(Object p) { if(p == null) return false; if(this == p) return true; if(!(p instanceof Point)) return false; Point tmp = (Point)p; return this.x == tmp.x && this.y==tmp.y; } // Possible but not recommended public boolean equals(Point p) { return this.x == p.x && this.y == p.y; } public Object clone() { try { return super.clone(); } catch(CloneNotSupportedException e) { throw new Error("Assertion failure"); // Can�t happen } } public static Point newInstance(Point p) { return new Point(p); } public static boolean sameLine(Point a, Point b, Point c) { throw new UnsupportedOperationException(); } public double distanceTo(Point p) { throw new UnsupportedOperationException(); } }