title: Encapsulation good practice
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/99688/private-vs-public-members-in-practice-how-important-is-encapsulation">Private vs. Public members in practice (how important is encapsulation?)</a>  </p>
  </blockquote>
  
  
  
  <p>Recently I've been coming across a situation where I declare a class variable as public, because it will be used in another class. Someone told me recently that I should make such variables private and write a public method returning the value of the variable. I was told this was good practice. I searched through my Java book and couldnt find any reference to this. My question is, is it good practice to declare as many as possible class variables as private?</p>