• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

abstraction in java

 
wrushasen dakhane
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to implement abstraction in java?

Please help me out with the simple definition and sample code to support that.

Wrushu
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12100
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do YOU think abstration is? What has your research shown? If you tell us what you think, we can correct you. You'll learn much more this way.
 
wrushasen dakhane
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just think abstraction means hidding the data.

Not giving the full access to the object entities.

But now I have the confusion here, then how the abstraction is different from encapsulation?

Wrushu
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you've described is "encapulation" (or data-hiding).

An example of "abstraction" is the implementation of a Fruit class:

Fruit: an example of abstraction

Both encapsulation and abstraction are benefits of object-oriented programming.

Kaydell
[ June 20, 2007: Message edited by: Kaydell Leavitt ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic