About 50 results
Open links in new tab
  1. java - What is Encapsulation exactly? - Stack Overflow

    Feb 20, 2015 · I have got two definitions of encapsulation which could not fit into one definition. Encapsulation is data hiding. With the use of private, protected and public, pack the data into single …

  2. oop - Java encapsulation - Stack Overflow

    Aug 15, 2012 · The beauty of encapsulation is the power of changing things without affecting its users. In an object-oriented programming language like Java, you achieve encapsulation by hiding details …

  3. java - What is the use of encapsulation when I'm able to change the ...

    Apr 22, 2017 · So, to answer the question, " What is the use of encapsulation when I'm able to change the property values with setter methods? ", given above are some of the main reasons why we use …

  4. Java Encapsulation Concept not clear - Stack Overflow

    May 7, 2025 · This is basic question but still i don't understand encapsulation concept . I did't understand how can we change the properties of class from other class.because whenever we try to …

  5. java - Encapsulation vs Abstraction? - Stack Overflow

    Jan 22, 2012 · Here are the brief definitions of encapsulation and abstraction. Abstraction: The process of abstraction in Java is used to hide certain details and only show the essential features of the obj...

  6. How to encapsulate an array in Java - Stack Overflow

    In this case Java doesn't usually bother with encapsulation at all, it just adds a helper method/class that can do things to the collection/array (look at the "Arrays" object for a bunch of great examples).

  7. Difference between abstraction and encapsulation? - Stack Overflow

    Apr 13, 2009 · Most answers here focus on OOP but encapsulation begins much earlier: Every function is an encapsulation; in pseudocode: point x = { 1, 4 } point y = { 23, 42 } numeric d = distance(x, y) …

  8. java - What is the purpose of Encapsulation? Does it provide a security ...

    May 28, 2019 · 1 The purpose of Encapsulation is two-fold: Bundling related functionality together; Controlling the access to fields and methods which participate in providing the functionality.

  9. java - Difference between Encapsulation and Abstraction - Stack …

    Mar 2, 2013 · 29 Encapsulation: Wrapping code and data together into a single unit. Class is an example of encapsulation, because it wraps the method and property. Abstraction: Hiding internal …

  10. oop - Can encapsulation be achieved in Java with getter and setter ...

    Mar 6, 2021 · Encapsulation in Java is achieved by making a class's fields private. Weaker encapsulation is achieved by making them protected. Getter and setter methods do not implement …