Introduction to Encapsulation in java:In this tutorial I am going to discuss about the real time
example of encapsulation in java hope it will helpful for you.

Encapsulation: [A mechanism which is to hide information (Data or
Implementation)] Here,the capsule means it is just a container or we can say
that a structure that enclose a body part (function or
class).

Img:Wikipedia

Encapsulation is a process of binding data member
(like variables, properties) and member function (like methods) into a single
unit. If we talk about class and function it is the best example of encapsulation
in java.

In other
word,encapsulation is the process of hiding the internal details of
an object.We can achieve encapsulation by hiding details using
the access modifier (Public,Private,Protected,Default).

Why we
use Encapsulation in java

4) The main goal
of Encapsulation is to achieve simplicity in our application.

5) Encapsulation in java allow you
to change one part of code without affecting other part line of code.

Encapsulation in java with realtime example:

Img:Wikipedia

Encapsulation play major role by developing the application the literal meaning
of abstraction or the simplest mean of show the operational part or providing
the operational part to the use is abstraction and encapsulation is
hiding the complexity from the user is set to be encapsulation

or

We can say if there is a encapsulation there will we
abstraction if we place and order for mobile to X company customer or
user is only consort for operation the mobile like brightness , volume
,sms,call,power off he is not caller of the internal component of the mobile
like electrical part of handset , how touch screen made he dosen't know
that's encapsulation.He only know functioning part of mobile or
operational part of mobile this call abstraction.