Difficulty with setters
<p>I having a class named Shape which has two subclasses Shape1 and Shape2. In the Shape class I have variables Xpos and Xpos and methods namely:</p>

<pre><code>public int getXpos(){
    return Xpos;
}

public void setXpos(int x){
    this.x = x;
}

// Same thing for y
</code></pre>

<p>Now let's just say in the class Shape, <code>x = 10</code>. Now when I inherit it:</p>

<pre><code>public class Shape1{
    Shape1(){
        xPos = 100;
        // ...
    }
}
</code></pre>

<p>and:</p>

<pre><code>public class Shape2{
    Shape2(){
        xPos = 200;
        // ...
    }
}
</code></pre>

<p>But when I do Shape1.getX() in another program, I get 10 as a result. Can someone tell me why I'm not getting 100? Is the problem with the 'this' keyword?</p>
