Explain in detail about encapsulation with an example?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Does isempty check for null?

542


What are three advantages of using functions?

528


What is api in java?

523


What is the use of jtable?

638


what is the volatile modifier for? : Java thread

514






What is 32 bit float?

551


What is finalize()?

592


what is ststic with example

1585


What is the use of a copy constructor?

563


How does the java compiler work?

518


How do you format in java?

539


What does nextint () do in java?

546


What is the difference between a synchronized method and a synchronized block?

597


What causes memory leaks in java?

477


Difference between == and .equals() ?

566