File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes difference b/w encapsulation vs abstraction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference b/w encapsulation vs abstraction" Watch "difference b/w encapsulation vs abstraction" New topic
Author

difference b/w encapsulation vs abstraction

sharma sachin
Greenhorn

Joined: Nov 13, 2009
Posts: 24
hello to all
can any one explain me in detail with real world example as well as with the help of program
the difference between data abstraction and data encapsulation.

and make me right if i m wrong:
according to me data encapsulation is data hiding
and data abstraction is providing the essential details of an object by ignoring the irrelevant details of an object.
in my opinion abstraction and encapsulation goes side by side i.e whenever there is encapsulation there must be the abstraction
for ex: playing pc games, withdrawing money from ATM.

ex of program

please take me out of this question if i had given wrong answer because it is the very basic concept and i want to clear this concept as soon as possible
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
Encapsulation is all about handling the details, of a bank account, for example.
The attributes of a bank account (e.g. owner, type, bank, balance, transaction
dates, etc.) are encapsulated in a class where operations can be performed on
them. The associated abstraction is the concept of a bank account. It is useful
when discussing bank accounts more generally; new accounts, accounts closed
this month and so on. An abstraction is a summary label for a set of details that
are encapsulated.

Jim ... ...


BEE MBA PMP SCJP-6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference b/w encapsulation vs abstraction