- The data fields of a class can be made read-only or write-only (for protecting data )
- A class can have total control over what is stored in its fields (for easy to maintain the class.)
- The user of a class don't know how the class stores its data. A class can change the data type of a field and users of the class do not need to change any of their code (for protecting data )
Text provided above does not means is the model answer, and it's was posted here for an reference to somebody who interested the related knowledge only. if there is something incorrect, please leave a comment so that i can correct it or for others viewer to have an better reference, if you want know more about this topic and where is the question, concept or answer from, you can reference from information provided under the reference sub-title.
Reference:
1) Introduction to Java Programming, Y. Daniel Liang 9.21
2) http://www.tutorialspoint.com/java/java_encapsulation.htm
No comments :
Post a Comment