/** * Represents a single (x,y) point in 2 dimensions * * Illustrates: * - Multiple constructors in a class */ public class Point{ private double xCoord; private double yCoord; /** * If the user does not specify an x- and y-coordinate * then we'll default to the origin (0, 0) */ public Point(){ xCoord = 0.0; yCoord = 0.0; } /** * Creates a new (x,y) point * @param x the x-coordinate * @param y the y-coordinate */ public Point(double x, double y){ xCoord = x; yCoord = y; } /** * Returns the x-coordinate */ public double getX(){ return xCoord; } /** * Returns the y-coordinate */ public double getY(){ return yCoord; } }