Encapsulation

In OOPs, these concepts are implemented through a class definition and achieved through the object creation process, programmatically.

Encapsulation

OOPs revolve around the four concepts:

1. Encapsulation
2. Polymorphism
3. Abstraction
4. Inheritance

In OOPs, these concepts are implemented through a class definition and achieved
through the object creation process, programmatically.

Here we will discuss Encapsulation briefly:

-- Encapsulation is an important programming
concept.
-- It helps in separating the states of an object from its behavior.
-- It plays a vital role in maintaining security in the code by hiding the
object's data (describing its state) from any unwanted external modifications.
-- Java provides the access rights to the external entities through the four
different access modifiers, these are public, private, protected and default.
-- Encapsulation allows the object being used within an application to know
about the data according to the user's requirement.
-- Unwanted data that is not required by an object is kept hidden by the
process of encapsulation. It is also known as information hiding.
--
Information hiding restricts the outsiders in seeing inside an object and
thus providing security.