title: Why are instance variables in Java always private?
body: <p>I'm newbie to Java and I'm learning about encapsulation and saw an example where instance variables are declared as private in a class.        </p>
  
  <p><a href="http://www.tutorialspoint.com/java/java_encapsulation.htm" rel="noreferrer">http://www.tutorialspoint.com/java/java_encapsulation.htm</a>       </p>
  
  <p>I have 2 queries:</p>
  
  <ol>
  <li>Why are instance variables private? Why not public?</li>
  <li>What if instance variables are made public and accessed directly? Do we see any constraints?</li>
  </ol>
  
  <p>Can you explain with an example as to what will go wrong in case the instance variables are declared as public in a class in Java?       </p>