Thursday, June 12, 2008

Explanation on Data Abstraction and Data Encapsulation

abstraction - The process of abstraction in Java is used to hide certain details and only show the essential features of the object.

Data hiding is just a means by which one hides away data from the external world... example, the lungs of a person is not seen by anyone, but used for the internal working of the human being!

Data Encapusation allows to package all the contents of the object. They may or may not be public to the external world. Example, the skin is part of the human, and so is the lung. Together all the components of the human make up one whole being!

Data Abstraction is the means by which one displays only what is required to the user. Sample - the mood of a person to a girl, a snake, a cat, a father, or a boss. Though they are all emotions, they differ based on the stimuli, and hence a portion of the whole is displayed to the person who requests it.

No comments: