title: Explain encapsulation in OOP
body: <p>I am new to OOP and I have some doubts regarding encapsulation.</p>
  
  <ol>
  <li><p>What is mean by difference between "partial" and "weak" encapsulation? An example in java will help me.</p></li>
  <li><p>Does encapsulation means only place data in capsule like a class, or does an access modifier have to be there? </p></li>
  </ol>
  
  <p>I read that encapsulation means to hide and club together data.</p>
  
  <p>In this example:</p>
  
  <pre><code>class A{ 
    public int a;
    public void foo(){}
  }
  </code></pre>
  
  <p>Is above code is example of encapsulation? If yes, then there is nothing hidden from outer world as <code>a</code> and <code>foo</code> are public. Must <code>a</code> and <code>foo</code> be <code>private</code> for this example to be considered encapsulation?</p>