Tuesday, April 10, 2007

What is Data Encapsulation?

Data Encapsulation is wrapping informations(attributes and behaviors) within an object.A suitable example is a class as it wraps methods and data within itself. The attributes of a class corresponds to its data members while behaviour corresponds to member methods of the class.

9 comments :

Nishanth Thomas ,Bangalore said...

Wrapping data and function into single unit is called encapsulation

Anonymous said...

Good Answer Nishanth....

Mandeep singh, Delhi said...

In other words, data encapsulation is basically binding together data and the methods that act on that data, into a single unit.

Mandeep Singh, Delhi said...

In other words, data encapsulation is basically binding together data and the methods that act on that data, into a single unit.

jenish on June 10, 2011 at 12:19 PM said...

encapsulation means class have a modifier like: private, protected and public.
private : other class can not access the data.
public : can access.
protected : class in different package can not access the data.

therefore its called data hiding.

jenish on June 10, 2011 at 12:23 PM said...

data encapsulation have a class modifier :
private : differnt class can not access data.
public : can access.
protected : class in different package can not access.
therefor, its called data hiding.

jenish on June 10, 2011 at 12:24 PM said...

data encapsulation have a class modifier :
private : differnt class can not access data.
public : can access.
protected : class in different package can not access.
therefor, its called data hiding.

jenish on June 10, 2011 at 12:24 PM said...

data encapsulation have a class modifier :
private : differnt class can not access data.
public : can access.
protected : class in different package can not access.
therefor, its called data hiding.

Anonymous said...

It is a mechanism to bind attributes and behaviours together to avoid outside interference and misuse

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker