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

all are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined classes and we can extend atmost one class so each class can extend more than one class so java supports multiple inheritance?i am confused with this,pls any one explain me.

8 Answers   CFG,


What is pre increment and post increment in java?

0 Answers  


Where is jre installed?

0 Answers  


Explain about assignment statement?

0 Answers  


What is the meaning of I ++ in java?

0 Answers  


what is bmg file and how to create that files?what will it contailn?

0 Answers   HCL, Probe Services,


What are java packages? What's the significance of packages?

0 Answers  


if i have one string class then how can you achive this class functionality of this class?

3 Answers   Fidelity, iFlex,


What is a null point?

0 Answers  


What are alternatives to java serialization?

0 Answers  


What is the difference between a method and a procedure?

0 Answers  


Hi, This is ravi i have a question like this i have string "UNDERSTAND" now i want to count the letters how many times it occures.i.e from the above string the out put should be like this U-1,N-2,D-2,E-1,R-1,S-1,T-1,A-1. how can i achieve this Thnaks in advance for your response ..

7 Answers  


Categories