public Point2D copyOf()
This method creates and returns a new, distinct Point2D object with data copied from this Point2D object.
public Point2D add(Point2D other)
This method creates and returns a new, distinct Point2D object that is the sum of this Point2D object and the Point2D object referenced by other. For example, the sum of points (1, 2) and (3, 4) is a new point (4, 6).
public Point2D midpoint(Point2D other)
This method creates and returns a new, distinct Point2D object that is the midpoint of the line segment formed by this Point2D object and the Point2D object referenced by other. For example, the midpoint of points (1, 2) and (3, 4) is a new point (2, 3). This method assumes that both the x and y coordinates of the midpoint are integers.
NOTE: Do not make copies of the objects used in instance methods unnecessarily. While the add and midpoint method should change neither this Point2D object nor the Point2D object referenced by other, the operations required to create the new Point2D object with the appropriate data naturally do not modify them.