thisThe keyword this has several uses in Java.
class Shape {
int x, y;
Shape() {
this(0, 0); // call another constructor
// must be the 1st statment in the constructor
}
Shape(int x, int y) {
this.x = x; // avoid name conflict
this.y = y;
}
. . .
} |