encapsulation example

Example 1: encapsulation programming

In object-oriented programming, encapsulation refers to the bundling 
of data with the methods that operate on that data, or the restricting
of direct access to some of an object's components

Example 2: what is encapsulation java

Encapsulation in Java is a mechanism to wrap up variables and methods together
as a single unit. It is the process of hiding information details and protecting
data and behavior of the object. It is one of the four important OOP concepts. 
 The encapsulate class is easy to test, so it is also better for unit testing.

Example 3: Encapsulation

In object-oriented programming, encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object's components