Social Sciences, asked by anikrahulgupta4203, 1 year ago

What is class how does it accomplish data hiding in java?

Answers

Answered by writersparadise
5
A class is a template or a model with which objects can be created. Any method or variable declared private can be accessed only within the class. They cannot be accessed externally. In other words, the private variables and data are hidden or encapsulated from outside the class.

This makes programming easy because the code written outside the class does not mess with the code that defines the class.
Similar questions