File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "abstraction in java" Watch "abstraction in java" New topic

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.


SCJP 1.4, SCWCD 1.4
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11952

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?

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.

[ June 20, 2007: Message edited by: Kaydell Leavitt ]
I agree. Here's the link:
subject: abstraction in java
It's not a secret anymore!