What is encapsulation in oops?

Kirti Kaushal
Kirti Kaushal

Posted On: Apr 08, 2020

 

Encapsulation is one of the most basic concepts in object-oriented programming (OOP). Encapsulation describes the concept of bundling methods and data that operate on that data within a unit like a Java class. It also manipulates the data and keeps it secure from both the outside and inside from misuse and interference.

Encapsulation of the data led to the vital concept of data hiding in OOP. In a nutshell, encapsulation is the wrapping of information and data under a sole unit. It is a process of binding together the functions and data that manipulates them. Encapsulation is implemented through access and class modifiers.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Cognizant Java Interview Questions

    What is a Singleton in Java?

    Singleton class in Java contains only one object at one time. For the designing of the singleton class, the construction needs to be private. The static method needs to be written to return the object...

    Cognizant Java Interview Questions

    Is Java supports multiple inheritance?

    When one class extends for more than one class, then it is known as multiple inheritance. No, Java does not support multiple inheritance to prevent the ambiguity that it can cause. The diamond proble...

    Cognizant Java Interview Questions

    What is JPA and Junit?

    JPA or Java Persistence API is a mechanism through which JAVA can outlive the application processes that have created them. JPA allows you to define which objects are persisted and how they should be ...