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 lambda expressions action func and predicate?
Are there tuples in java?
How do you create a jar file?
Explain the common use of ejb?
What is the difference between lambda expression and anonymous methods?
What is class forname java?
How should I format my code? How should I comment my code?
What are the disadvantages of java sockets?
Can we extract main method from another class?
What is the purpose of jdk?
What is scrollable resultset in java?
Why oracle type 4 driver is named as oracle thin driver?
What is the difference between Logical Parallelism and Physical Parallelism?
What is stateless object in java?
What is data encapsulation?