Search Interview Questions
| 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.
|Interview Questions and Answers|
|Very frequently asked. Usually among very first few questions.|
|Ans. Encapsulation is a feature of OOP's that binds the data and it's associated methods together as a single unit and facilitate protection and data hiding by providing minimal interface to outside. For example - member variables are declared private and are accessed through public methods. Moreover we have private methods that can only be used internally and hence providing minimal interface to outside class through use of public methods.|
Sample Code for encapsulation
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  encapsulation  object oriented programming (oops)  oops concepts  oops  oops concepts  oops features Asked in 4 Companies Basic   frequent|
|What is the difference between Encapsulation and Abstraction?|
|Can you give a real world example of Encapsulation and Abstraction ?|
| Which of the following Java feature promotes access protection or Hiding ?|
|What are the features of encapsulation ?|
|How is Abstraction implemented in Java ?|
|Why it's a good practice to expose member elements through getter methods ?|
|Difference between Encapsulation and Data Hiding ?|
|How can we hide a class in Java ?|
|Which of the OOP's feature - encapsulation or abstraction - is more important ?|