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 .net better than java?
What are the differences between string, stringbuffer and stringbuilder?
Can we extend private class in java?
Can the interface be final?
Define nashorn in java8.
How do you initialize an arraylist in java?
What is mean by exception?
What is JFC?
What does it mean that strings are immutable?
What is the major difference between linkedlist and arraylist?
What is the difference between equals() and?
Define linked list and its features with signature?
what is the difference between thread and runnable types? : Java thread
What are the default and parameterized constructors?
How infinite loop is declared?