class Point {
  ...


  public boolean equals(Object o) {
    // if o isn't a point
    //          return false;
    if (!(o instanceof Point)) {
    }
    return this.x == o.x &&
        this.y == o.y;
  }
}



usage:

Point p1 = whatever;
Point p2 = whatever other thing;

if (p1.equals(p2)) 
