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
When should I use a singleton?
What is an example of a conditional statement?
What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?
What is the difference between @before and @beforeclass annotation?
What are the object and class classes used for?
What are the Main functions of Java?
Can list be null in java?
What are static variables and functions?
Which keyword specify that a variable is effectively final ?
Can static methods be inherited?
Is there a case when finally will not execute?
What is lossy conversion in java?
What a static class can contains?
Name some OOPS Concepts in Java?
What is string literal in java?