OOP Concept for Beginners: What is Encapsulation
Encapsulation is one of the fundamental concepts in object-oriented programming (OOP). Let’s examine how it’s done and unwrap some examples for this concept. By definition, encapsulation describes the idea of bundling data and methods that work on that data within one unit, like a class in Java. This concept is also often used to hide the internal representation, or state of an object from the outside. This is called information hiding. The general idea of this mechanism is simple.