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 the difference between the size and capacity of a vector?
What are keywords give examples?
What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?
Write a factorial program using recursion in java?
What are the library functions in java?
How do you check if an arraylist is not empty?
What is io stream in java?
What is static import in java?
What are keywords and reserved words in java?
How do I get 64 bit java?
When should I use stringbuffer?
What is keyword auto for?
What is the difference between superclass and subclass?
can used Protected Class outside Function.?
What are different types of arrays?