class Point {
private int x, y;
/** Count number of points used */
private static int numPoints = 0;
/** Point constructor */
Point(int ix, int iy) {
x = ix;
y = iy;
numPoints++; // Adjust points counter
}
/** Point constructor */
Point() {
x = y = 0;
numPoints++; // Adjust points counter
}
// Return number of points currently used
public static int getNumPoints() {
return numPoints;
}
static public void main(String args[]) {
Point a = new Point(1, 2);
Point b = new Point(5, 8);
Point c = b;
System.out.println(getNumPoints() + " points have been created");
}
}