+ 2
Why data members in class is to be private?
3 Réponses
+ 3
If you don't want to give access to another class to change your data member , it is to be declared as private. For example if a developer has made a new app and it has some data member , he built the app and he don't want client to read or change its source code, so at that time , creating a private data member is useful.!!hope you understand!
+ 1
Check out the comments on the lesson.
https://www.sololearn.com/learn/Java/2162/?ref=app