In: Computer Science
In JAVA, Briefly explain how objects are able to achieve both data hiding and implementation hiding.
Answer)
In Java, Data hiding as well as encapsulation are considered to be internal fields as well as methods that are visible to that of the outside of the class with respect to API. These are used for keeping the visible fields to a minimum and hence keeping the system tidy and easier for use and understanding. When a field or method is marked visible to the user, one needs to document the same.
Encapsulation is used for keeping the data and functions intact and together and safe from any interference of the outer world. Data hiding is also used for hiding the implementation. This is a process meant for combining the data as well as function to that of the single unit and data would have private and public information in it. The data which is hidden would be marked safe from any manipulation and private members would be accessed by the methods of defining the part of the class.
Please comment in case you need any other inputs.
Please share a like if you find the answer helpful.
Thank you.