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 ehcache in java?
Topic- looping,function overloading,nesting ,polymorphism. Aim - to write a function with a name buzz-buds,that will check whether the given numbers are buddies or not on the basis of no. of parameters passed during function calling.
What is profile in java?
What is flatmap java?
Why we use beans in java?
In java thread programming, which method is a must implementation for all threads?
Explain the inheritance principle.
How do you find lambda?
What are microservices in java?
can anyone tell me what kind of questions are asked for core java exam in aptech
What do you understand by downcasting?
How can the static main method use instance variables?
How can I write a program that takes command line input?
What is ioexception in java?
How do I enable jvm?