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
If system.exit (0); is written at the end of the try block, will the finally block still execute?
Can you explain the final method modifier?
Can we declare the static variables and methods in an abstract class?
What is the file type?
When is the finally clause of a try-catch-finally statement executed?
Which methods cannot be overridden in java?
What is the Concept of Encapsulation in OOPS
What is the epoch date?
what is the purpose of "virtual"?
can I implement my own start() method? : Java thread
Objects or references which of them gets garbage collected?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
What is an abstract class and what is it’s purpose?
Why are arrays useful in java?
What is anagram of a string?