Explain the encapsulation principle.



Explain the encapsulation principle...

Answer / Yash Kumar

The Encapsulation principle is a key concept in object-oriented programming that helps to hide the internal details or implementation of an object from the outside world. This hiding mechanism protects the object's state and behavior from being directly accessed by other objects, making the system more modular, secure, and easier to maintain. In Java, encapsulation is achieved by declaring variables as private and providing public methods (getters and setters) to access those variables.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

How do I run a project in eclipse?

1 Answers  


What is use of jpa?

1 Answers  


Is eclipse a jdk?

1 Answers  


What are the advantages of lambda functions?

1 Answers  


Can you compile java into exe?

1 Answers  


I am trying to create a new universal user group. Why can't i? : java security

1 Answers  


What is jboss in java?

1 Answers  


explain isalive() method under thread class?

1 Answers  


What is ioexception in java?

1 Answers  


What is javabeans api?

1 Answers  


What are jpa repositories?

1 Answers  


What is the difference between Enumeration and Iteration interfaces? What is the way of to retreive the objects from these interfaces ?

1 Answers   Cap Gemini,


Categories