Use this to reference current object - Java Object Oriented Design

Java examples for Object Oriented Design:this

Description

Use this to reference current object

Demo Code

class Point {
    public int x = 0;
    public int y = 0;

    // a constructor!
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }//from  w  w  w  .  j a  v a2 s .  c  om
}

Related Tutorials