This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
What is the purpose of data encapsulaton in Java?
Post Flair (click to view more posts with a particular flair)
Post Body
Hi, recently came from an interview and I got asked what data encapsulation is for. Come to think of it, I have no idea why people would want to put variables or methods to private or limit it to only that class it's from instead of making it public. Just a fairly basic question as to why would I want to use this feature of Java in my program.. almost all variables and methods I create are accessible through public or is set to public.
Author
Account Strength
90%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,724
Link Karma
1,904
Comment Karma
820
Profile updated: 1 day ago
Posts updated: 2 weeks ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...