title: Encapsulation vs Abstraction?
body: <p>Here are the brief definitions of encapsulation and abstraction.</p>
  
  <p>Abstraction:</p>
  
  <blockquote>
    <p>The process of abstraction in Java is used to hide certain details and
    only show the essential features of the object. In other words, 
                 it deals with the outside view of an object (interface).  The only good example i see for this  across different sites is
    interface.</p>
  </blockquote>
  
  <p>Encapsulation:</p>
  
  <blockquote>
    <p>Its basically about hiding the state of object with the help of
    modifiers like private,public,protected etc. we expose the state thru
    public methods only if require.</p>
  </blockquote>
  
  <p>What we achieve with modifiers like <code>private</code>, <code>public</code> also hides unnecessary details from out side world which is nothing but also a abstraction concept</p>
  
  <p>So, from above explanation looks like encapsulation is a part of abstraction or we can say it's a subset of abstraction. But why then encapsulation term is invented when we could deal it with abstraction only? I am sure there should be some major difference which distinguishes them but most of material on net says almost same thing for both of them.</p>
  
  <p>Though this question has been raised on this forum earlier too but I am posting it again with specific doubts. Some replies also says abstraction is a concept and encapsulation is implementation. But I don't buy this - If it is true, then I can think these two different concepts are provided to confuse us.</p>
  
  <p><strong>Update:-</strong> After 5 years i have come up with my own answer whichs is the gist based on answers in this post and below ones</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/742341/difference-between-abstraction-and-encapsulation">difference between abstraction and encapsulation?</a></li>
  <li><a href="https://stackoverflow.com/questions/12072980/encapsulation-vs-abstraction-real-world-example/12073125?noredirect=1#comment67650215_12073125">encapsulation vs abstraction real world example</a></li>
  </ol>