Explain in detail about encapsulation with an example?

Answers were Sorted based on User's Feedback



Explain in detail about encapsulation with an example?..

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

Explain in detail about encapsulation with an example?..

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

Explain in detail about encapsulation with an example?..

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

Explain in detail about encapsulation with an example?..

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

Post New Answer

More Core Java Interview Questions

What is compile time polymorphism?

20 Answers   CTS, Elementus Technologies, Oracle,


What is keyword auto for?

0 Answers  


Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.

0 Answers   V2 Solutions,


Which is better stringbuilder or stringbuffer?

0 Answers  


Explain the difference between arraylist and linkedlist in java?

0 Answers  






Can You Have Virtual Functions In Java?

0 Answers  


What is argument in java?

0 Answers  


How do you access command-line arguments within the code?

0 Answers   Flextronics, Hexaware,


Can we extend a class with private constructor?

0 Answers  


What is boolean example?

0 Answers  


What is the difference between the file and randomaccessfile classes?

0 Answers  


What are use cases?

0 Answers  


Categories