It's not a secret anymore!
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

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!
Visit my blog
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46337
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.
I agree. Here's the link:
subject: how to achieve abstraction ?
jQuery in Action, 3rd edition