what is meant by Encapsulation?Explain with an example?
Answers were Sorted based on User's Feedback
Answer / rekha
ENCAPSULATION MEANS WRAPPING DATA MEMBERS & MEMBER FUNCTION
IN A SINGLE UNIT.EXA:-CLASS
| Is This Answer Correct ? | 12 Yes | 1 No |
Answer / sanjay deorari
Containing and hiding information about an object, such as
internal data structures and code.
Binding together of related data and functions to
perform some set of specific operations is encapsulation.
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / santhosh kandula
Encapsulation is nothing but hiding the data.By using
encapsulation the ability to modify the code without
without breaking the code the other who use our code. In
Encapsulation we have to pass private members and access
via the public modifiers.
Example : public class EncapsDemo
{
private String str;
public String getString()
{
return str;
}
public void setString(String str)
{
this.str=str;
}
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Do I really have to type in the programs in the book to try them out?
Employee has a Passport. here employee is an object and passport is an object, give the class design
Can java program run without jdk?
Is jprofiler open source?
What is Map,List,hashtable,ArrayList and difference between them??
What is an api in java?
Is it correct to say that using parentheses can only change?
what are the types of constructer explain with example
What is the point of lambda expressions?
Where are group policies stored? : java security
Is java Class Thread safe ???? How to make java Class Thread safe ??
What is a delimiter in java?