The this Keyword : This « Class Definition « Java Tutorial






You use the this keyword from any method or constructor to refer to the current object.

public class Box {
    int length;
    int width;
    int height;
    public Box(int length, int width, int height) {
        this.length = length;
        this.width = width;
        this.height = height;
    }
}








5.13.This
5.13.1.The this Keyword