class Point extends Object {
public double x; // instance variable
public double y; // instance variable
// constructor to create a point & set default = zero
Point () {
x = 0.0; y = 0.0;
}
// constructor to set specific values
Point (double x, double y) {
this.x = x; this.y = y;
}
} // end Point ==> can also use this.x, this.y
Previous slide | Next slide | Back to first slide | View graphic version |