Saturday, November 26, 2011

Class Definition » This

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;
    }
}
 
http://www.java2s.com/Tutorial/Java/0100
__Class-Definition/0180__This.htm

No comments:

Post a Comment