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 indexof?
How can I right-justify a string?
Explain listiterator and methods in listiterator?
What are "class access modifiers" in Java?
Which is better arraylist or vector?
How do you do descending order in java?
What is the meaning of immutable regarding string?
Which variables are stored in stack?
For class CFoo { }; what default methods will the compiler generate for you>?
What are the benefits of operations in java?
Why are the objects immutable in java?
Do I need java for windows 10?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
What is string :: npos?
Can a constructor call another constructor?