/***
 * Point
 * 
 *  an (x,y) point in the plane.
 *
 ***/

class JimsPoint {

    // ------ static (class) variables and methods ----------------------

    // There is only one of these for the whole class.
    private static int numberOfPoints = 0;

    // This method can be invoked on the class itself, 
    // i.e. JimsPoint.howMany()
    // It can only refer to static variables.
    static int howMany(){
	return numberOfPoints;
    }


    // ------ instance variables and methods -------------------

    // On the other hand, these exist within instances creates with "new".
    private double x;
    private double y;
    
    // Note that instance methods can refer to static variables.
    JimsPoint(double xValue, double yValue){
	x = xValue;
	y = yValue;
	numberOfPoints++;
    }
    JimsPoint(){
	x = 0.0;
	y = 0.0;
	numberOfPoints++;
    }

    double getX(){
	return x;
    }

    double getY(){
	return y;
    }

    String asString(){
	return "("+x+","+y+")";
    }


}


syntax highlighted by Code2HTML, v. 0.9.1