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
Is there is any difference between a scrollbar and a scrollpane?
Where import statement is used in a java program?
What are the states of thread in java?
What is the base class of all exception classes?
What is the difference between post and put?
How do you do exponents in java?
What does isempty () do in java?
What is meant by class?
What is a class instance variable?
Can we have a method name same as class name in java?
How to create com object in Java?
How do you calculate square roots?
Difference between a process and a program?
What is the purpose of main function in java?
What is the primitive type byte?