What is meant by Encapsulation? Can you write a class to
explain encapsulation?
Answer Posted / sivakishorereddy(badvel)
-Encapsulation is wrapping of data(Data members) and
associated methods(member functions) into a single unit in
such a way that data can be accessed with the help of
associated methods.
--In a class we can specify the variables(Data members) as
private. So for other classes it will not be accessible.
--Through methods(member functions) only we can access the
member variables or modify them.
--It gives more security for our data. It is nothing but
data hiding.
| Is This Answer Correct ? | 19 Yes | 1 No |
Post New Answer View All Answers
What is difference between char array and string?
What is an argument java?
What are the features of junit?
What is hashing principle in java?
Where are register variables stored?
What environment variables do I need to set on my machine in order to be able to run java programs?
What is equlas() and hashcode() contract in java? Where does it used?
What is a singleton class? Give a practical example of its usage.
What is functional interface in java?
What is keyword and identifier?
Explain throw keyword in java?
What is difference between equal and == in java?
What are different access specifiers in java?
What is an class?
What is lastindexof in java?