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
Is eclipse a jdk?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. Define how can I implement this logic?
How do I enable java in google chrome?
What type of parameter passing does java support?
How do you check if java is installed on windows command prompt?
How do I enable java in firefox?
What is difference between map and flatmap in java 8?
Can we write lambda without functional interface?
How do I run a java project in netbeans?
What is scrollable resultset in java?
What is microservices java?
Why dependency injection is used in java?
What is the difference between lambda expression and anonymous methods?
What is flatmap in rxjs?
What is the point of lambda expressions?