Not sure whether I am writting at correct place or Not:-
Can anyone answer me, Why data members are private when we can access them through getter/setters?. why we dont make it public then?
-I gave answer like, if you want to validate your data, like adding some condition kinda, you can do it by adding just that code in getter and it will reflect everywhere but if it is public we have to change code everywhere..
And same for setter we can have validation like not greater or less than this etc....
But interviewer was still not happy...
Any other addition to my answer?