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
What is the purpose of sizeof operator?
Explain the use of sublass in a java program?
Can we declare a static variable inside a method?
What is space character in java?
Explain the importance of finally over return statement?
Can we override protected method in java?
Write a program in java to create a doubly linked list containing n nodes.
What is the difference between post and put?
How you can force the garbage collection?
Explain the difference between static and dynamic binding in java?
What are different types of control structures?
Explain method local inner classes ?
why using interface interface ?
how to prepare for IT Officers Interview in Banks
What does math floor () do?