Warning: mysqli::__construct(): (HY000/1226): User 'vivekvermani1234' has exceeded the 'max_user_connections' resource (current value: 30) in /home/vivekvermani/public_html/InterviewQuestions/questionSearch.php on line 518
Warning: mysqli::set_charset(): Couldn't fetch mysqli in /home/vivekvermani/public_html/InterviewQuestions/questionSearch.php on line 519 Design - Interview Questions and Answers for 'Oops example' | Search Interview Question - javasearch.buggybread.com
More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. You can implement encapsulation in Java by keeping the fields (class variables) private and providing public getter and setter methods to each of them. Java Beans are examples of fully encapsulated classes. Encapsulation in Java: Restricts direct access to data members (fields) of a class.
Help us improve. Please let us know the company, where you were asked this question :