First1Last
1 of 1 pages
  1. Answer
    Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding.

    Explanation: Not available 


    1. Forum
  2. Answer
    1. Encapsulated Code is more flexible and easy to change with new requirements.
    
    2. Encapsulation in Java makes unit testing easy.
    3. Encapsulation in Java allows you to control who can access what.
    4. Encapsulation also helps to write immutable class in Java which are a good choice in multi-threading
    environment.
    5. Encapsulation reduce coupling of modules and increase cohesion inside a module because all piece of one thing
    are encapsulated in one place.
    6. Encapsulation allows you to change one part of code without affecting other part of code.

    Explanation: Not available 


    1. Forum
First1Last
1 of 1 pages