// CSE 143, Summer 2012 // Simple class that represents a point // Used to demonstrate how to write an equals method public class Point { private int x; private int y; public Point(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public int getY() { return y; } public void setLocation(int x, int y) { this.x = x; this.y = y; } public boolean equals(Object p) { if (p instanceof Point) { Point other = (Point) p; return this.x == other.x && this.y == other.y; } else { return false; } } }