answersLogoWhite

0

Encapsulation is the the hiding of code inside of Objects. The method of performing encapsulation practices is set in a Class's Meta Data inside of the class declaration. To be more specific the modifers of class attributes and methods can be either private or public.

Example 1

// Placing before the attribute declaration the public modifier allows this attribute to be
// accessed by other objects or the main method.

public int age;


Example 2

// Placing private before the attribute declaration prevents other object or the main method
// from accessing the data.

private int age;



User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Why is encapsulation called wrapping?

Encapsulation is also known as wrapping because it wraps the data in the same way as a toffee is wrapped to create a logical insulation between the data(program) & the outer world(computer).


Is it true that wrapping up of data of different types into a single unit is known as encapsulation?

Not quite. Encapsulation means to combine data and the methods that work upon that data into a single unit (an object), such that access to both the data and methods is restricted in a controlled manner. Data-hiding is fundamental to encapsulation.


What is encapsulation and data hiding in dbms?

ODBMS stands for object oriented database management system. Encapsulation in ODBMS can be defined as binding of data together.


What is pdu encapsulation?

protocol data unit


What does it mean by encapsulation?

Encapsulation makes class fields private, preventing access to it from outside of the class. Essentially, this data is hidden from the rest of the program. It is possible to allow access to the fields via public methods.


Wrapping of data in a single unit is called?

encapsulation


Which layers of the OSI model are involved in data encapsulation?

none


What are two main components of data confidentiality?

encapsulation encryption


What are the characteristics of OOPS?

Data Encapsulation, Abstraction, Inheritance, Polymorphism


What is mean by encapsulation of data?

In general, encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent.


How data hiding is achieved in java?

Data hiding in the java is achieved through the use of encapsulation.


How does data encapsulation allows data to be transported across the network?

The physical address is added