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
How do you add an element to a hashset in java?
What is a function easy definition?
What are methods of a class?
Describe what a thread-local variable is in java?
How to change value in arraylist java?
How many digits is int32?
What are the differences between Java 1.0 and Java 2.0?
What is the difference between static binding and dynamic binding?
Explain the public class modifier?
Why is whitespace important?
Does importing a package imports its sub-packages as well in java?
What is a blocking method in Java?
What does regex mean?
Do you know why doesn't the java library use a randomized version of quicksort?
What is a method signature java?