//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Example 1.7 on page 7
//  Testing a Point class

public class Ex0107
{ public static void main(String[] args) 
  { Point p = new Point(2,3);
    System.out.println("p = " + p);
    System.out.println("p.hashCode() = " + p.hashCode());
    Point q = p.getLocation();
    compare(p,q);
    q.translate(5,-1);
    compare(p,q);
    q = p;
    compare(p,q);
  }
  private static void compare(Point p, Point q)
  { System.out.println("q = " + q);
    System.out.println("q.hashCode() = " + q.hashCode());
    if (q.equals(p)) System.out.println("q equals p");
    else System.out.println("q does not equal p");
    if (q == p) System.out.println("q == p");
    else System.out.println("q != p");
  }
}
