Necessity of getter methods
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1568091/why-use-getters-and-setters">Why use getters and setters?</a>  </p>
</blockquote>



<p>This is a newbie question. Is it very much necessary to use getmethods to access property values?  Once the value has been assigned, one can get the values directory.  For example, in the below code, <code>displayName()</code> can display firstName value without the help of any getter method.  Or it is a standard coding standards that one must have getter and setter method or any other methods which gives that value?</p>

<pre><code>class Test{

    private String firstName;

    public void setName(String fname){
        firstName = fname;
    }

    public void displayName() {
        System.out.println("Your name is " + firstName);
    }
}          
</code></pre>
