### Question:
XYCoordinate implements Comparable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYCoordinate)) { return false; } XYCoordinate that = (XYCoordinate) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } return true; } XYCoordinate();  XYCoordinate(double x, double y); double getX(); double getY(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override int compareTo(Object obj);  }### Answer:
@Test public void testEquals() { XYCoordinate v1 = new XYCoordinate(1.0, 2.0); XYCoordinate v2 = new XYCoordinate(1.0, 2.0); assertEquals(v1, v2); assertEquals(v2, v1); v1 = new XYCoordinate(1.1, 2.0); assertFalse(v1.equals(v2)); v2 = new XYCoordinate(1.1, 2.0); assertEquals(v1, v2); v1 = new XYCoordinate(1.1, 2.2); assertFalse(v1.equals(v2)); v2 = new XYCoordinate(1.1, 2.2); assertEquals(v1, v2); }