what is meant by Encapsulation?Explain with an example?
Answer Posted / 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 |
Post New Answer View All Answers
What is jpa project?
What is the java api?
Is lambda expression an object?
Why serialization is used in java?
What are the benefits of a jar file?
What is flatmap in rxjs?
What is the first argument of the string array in main method?
What is meant by annotation in java?
What is a jvm?
What is the difference between jar and executable jar?
Why sun introduce concept of anonymous class? What is need and real life use of anonymous class
What are jpa annotations?
What is the use of flatmap?
What is serializable in java?
Is jprofiler open source?