Tightly Encapsulated Class
<p>This is my homework question : 
Which among the following classes is NOT Tightly Encapsulated?</p>

<pre><code>class A
{
    private int x;
}
class B
{
    private int x;
    public void setX(int x)
    {
        this.x=x;
    }
    public int getX()
    {
        return x;
    }
}
class C
{
    private int x;
    private void setX(int x)
    {
        this.x=x;
    }
    private int getX()
    {
        return x;
    }
}
</code></pre>

<p>I spent some time searching on coderanch but was not able to get the required stuff. Can anyone please help me?</p>

<p>What I think is Class C is not tightly encapsulated;because the methods are private. And about class A what I feel is it is not encapsulated only. Because basic definition of encapsulation says that "You must hide your members and provide to the class user methods that behave the way you want." Now the class A has no accessor-mutator methods. So A should not be considered encapsulated. I am not sure but. Please correct me if I am wrong.</p>
