Javatpoint Logo

use of encapsulation in java

By: sskira*** On: Sun Apr 26 14:57:32 IST 2015     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
what is the use of encapsulation in javaUp0Down

 
Hiding unnecessary data from the user...
for ex:capsule is the best example of encapsulation
Image Created0Down

By: [email protected] On: Sun Apr 26 18:10:35 IST 2015 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
For hiding the unnecessary data from user which are not belong to user
ex:capsule is d beast example of encapsulation
because don't bother about what inside the capsule he want only become good ...
Image Created0Down

By: [email protected] On: Sun Apr 26 18:19:12 IST 2015 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
Encapsulation is process of binding the code and data into a single unit. when ever we need to restrict the data from out side of class people then we can make our data members as private. the example is JavaBean class. Image Created0Down

By: [email protected] On: Sun Apr 26 22:41:13 IST 2015 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
hi,
encapsulation is a process of hiding from external user(class). External user can us hidden data+code functionilities only not data and code.that is use of data encapsulation.here data and code is safe and funcitionality is utilized by external user(class).
Image Created0Down

By: [email protected] On: Mon Apr 27 12:26:24 IST 2015 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 
Encapuslation is one of the oops concept.

EX :
Encapsulation = Data hiding + Abstraction.

class EncapsulationTest{
Private empName ;
private empId;
//Get.. and set.. methods.

}

Encapsulation nothing but putting datamembers and member functions in a single unit.so that out side class can not access data directly and modify data directly.

Note : Encapsulation provides data security!!!!


Image Created0Down

By: [email protected] On: Wed Apr 29 12:22:12 IST 2015 Question Reputation0 Answer Reputation1 Belt Series Points0 1User Image
Are You Satisfied :0Yes0No