aspose file tools*
The moose likes Beginning Java and the fly likes abstraction in java 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 "abstraction in java" Watch "abstraction in java" New topic
Author

abstraction in java

wrushasen dakhane
Ranch Hand

Joined: Sep 25, 2006
Posts: 47
How to implement abstraction in java?

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

Wrushu


SCJP 1.4, SCWCD 1.4
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11240
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
wrushasen dakhane
Ranch Hand

Joined: Sep 25, 2006
Posts: 47
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

Joined: Nov 18, 2006
Posts: 689

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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: abstraction in java