What is Encapsulation in java?
Answers
Answered by
5
HEY USER ,
HERE IS YOUR ANSWER :-
⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️ ⬇️
⭕ Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance polymorphism and abstraction.
⭕ Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. It declares the variables of a class as private.
⭕ In not simpler terms Encapsulation is an object oriented programming concept that binds together the data and functions that manipulate the data , and that keeps both safe from outside interferences and misuse .
⭕ Data Encapsulation led to the important OOP concept of data hiding.
⭕ The best example of Encapsulation is the calculator.
HOPE IT HELPS YOU ❣️
Answered by
3
Explanation:
Encapsulation in Java
Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule which is mixed of several medicines.
We can create a fully encapsulated class in Java by making all the data members of the class private. Now we can use setter and getter methods to set and get the data in it.
The Java Bean class is the example of a fully encapsulated class.
Similar questions