encapsulation of class java code example
Example: 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.