Encapsulation in Java | Core Java Online Training

This Core Java Online Training “Encapsulation in Java” page explains clearly what is encapsulation and how we protect object information using Encapsulation.


 

Encapsulation:

  • Writing data (variables) and code (methods) into a single unit.
  • In Java application, we define Objects.
  • In the communication world, Objects will communicate.
  • Objects are visible but not their properties and functionality.
  • Encapsulation is the concept of protecting object functionality from outside view.
  • Class is a cap of object as shown in diagram.
  • In java, we can achieve Encapsulation using “class”.

 

Share this