File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to achieve abstraction ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to achieve abstraction ?" Watch "how to achieve abstraction ?" New topic
Author

how to achieve abstraction ?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

i know we can achieve inheritence with the help of the keyword
i know we can achieve encapsulation by keeping my instance variable private and providing setters and getters method public
i know we can see polymorphism by creating the reference of super class and object of base class like and i also know run and compile time polymorphism
but my question is how to achieve abstraction ?
i think getter methods provide abstraction but i m not clear with that can any one explain me this ?

The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38818
    
  23
Abstraction means that a class represents something in real life. Whichever data you want about the real-life object, you create a class which has the same data, and the class acts as an abstraction.

If a person has name and age, then a Person class with name and age fields acts as an abstraction of a Person. If you want to do anything with those data, the class (or more precisely the instance) does that too.
 
Don't get me started about those stupid light bulbs.
 
subject: how to achieve abstraction ?