This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

abstraction in java  RSS feed

 
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
Posts: 12542
48
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: 690
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!