What is data encapsulation? What does it buy you

Showing Answers 1 - 8 of 8 Answers

joadavis

  • Jun 3rd, 2005
 

The most common example I can think of is a javabean. Encapsulation may be used by creating 'get' and 'set' methods in a class which are used to access the fields of the object. Typically the fields are made private while the get and set methods are public. 
 
Encapsulation can be used to validate the data that is to be stored, to do calculations on data that is stored in a field or fields, or for use in introspection (often the case when using javabeans in Struts, for instance).

anil sharma

  • Jul 27th, 2005
 

Wrapping of data and function into a single unit is called as data encapsulation. 
 
It buys the data security(oops feature).

  Was this answer useful?  Yes

Amit Gohil

  • Aug 5th, 2005
 

Encapsulation is a mechanism that combine to gether code and data that it manipulate. It is protective wraper to prevent the access of code and data from out side world or we can say from other class.

  Was this answer useful?  Yes

Pavan

  • Sep 2nd, 2005
 

The basic "class cocept" of Java is nothing but Encapsulation. In a class Data members and methods are wrapped / combined. In a class we can specify the variables as private. So for other classes it will not be accessible. Thru member functions / methods only we can access the member variables or modify them. It gives more security for our data.

  Was this answer useful?  Yes

sai

  • Sep 28th, 2005
 

it is datahiding

it is one of the oops features only

  Was this answer useful?  Yes

Ravi Kumar

  • Oct 17th, 2005
 

Encapsulation:wrappering up the data and associated methods into a single unit in such a way that  data can be accessed with the help of associated methods.

Encapsulation provides data security.  It is nothing but data hiding.

  Was this answer useful?  Yes

Devidas Sonawane

  • Oct 28th, 2005
 

Encapsulation:- it is a mechanism to binds data and bytecodes and b'coz of that data is protected and becomes secure. 

  Was this answer useful?  Yes

ragini.rani

  • Mar 13th, 2006
 

encapsulation mean data hiding.data correspond to varibles and methods of the class. Data hiding mean: when u make different objects of the same class. The data stored in one object is unaware of the data for other object of the same class. In, this way it gives secure data.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions