Explain in detail about encapsulation with an example?
Answers were Sorted based on User's Feedback
Answer / ravikiran(aptech mumbai)
encapsulation is the one which will bind members and methods
into a single entity
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / sanjay singh chauhan
it is way to combine field and mathod in a single entity
like a capsule ;
class A
{
int i;
void m(int i)
{
//body of this mathod ;
}
}
like this way;
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / aditya mohata
encapsulation is hiding detalis which u dont wanna show it
publicly or u dont want it to b modified.
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / sivaprasad addepalli
Encapsulation is a mechanism which binds the attributes or
variables and methods together as a single entity known as
class.
ex:
class sample
{
public:
int a;
public:
void test()
{
}
}
Encapsulation is a concept of datahiding,
| Is This Answer Correct ? | 5 Yes | 0 No |
is JVM platform dependent or independent..?
11 Answers IBM, Tech Mahindra,
Explain differences between collection api and stream api?
What is singleton service?
Define locale.
Howmany address lines are required to addressing 1 MB memory?
8 Answers Beatroot Technologies, CSC, HCL, Hexaware, IBM,
What are the names of interfaces that doesn't consists of method/s ?
What is deadlock and how to avoid this?
Is multiple inheritance allowed in Java? Why ?
What is the static variable?
How is string stored in java?
What is the static block?
Is a class an object?