What is meant by Encapsulation? Can you write a class to
explain encapsulation?
Answer Posted / srinu
Encapsulation=DataHidding+Abstraction is called
Encapsulation is called Encapsulation
EX:-
public class A
{
private String name;
private int age;
publiic setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
public setAge(int age)
{
this.age=age;
}
public int age()
{
return age;
}
}
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
How can constructor chaining be done using this keyword?
Can a final variable be null?
What is final variable?
What is api data?
How big is a gigabyte?
What are the main uses of this keyword?
Explain about narrowing conversion in java?
Enlist diffrent types of inheritance supported by java?
What’s the difference between unit, integration and functional testing?
What are the features in java?
What is tree in java?
What is immutable data?
Is array serializable java?
Define an abstract class with reference to java.
What is int short for?