What is meant by Encapsulation? Can you write a class to
explain encapsulation?
Answer Posted / rajasekhar
It is the ability of an object to hide its data and methods
from the rest of the world.
A Class may contains a few members in the form of
properties,events,fields or methods.These members of the
class are not exposed to the outer world directly.Rather
they are ENCAPSULATED by the Class.
Public Class Calculations
{
Private void fnMultiply(int x, int y)
{
return x*y;
}
}
Calculations Obj;
int Result;
Result = Obj.fnMultiply(5,10);
| Is This Answer Correct ? | 19 Yes | 10 No |
Post New Answer View All Answers
What are different types of inner classes ?
What are the different tags provided in jstl?
What is serialversionuid?
What methodology can be employed to locate substrings inside a string?
Can finally block be used without a catch?
Why we use protected in java?
What is the default value of an object reference declared as an instance variable?
Why can't we use static class instead of singleton?
What are the 8 primitive data types in java?
What is Session reduplication and how its done?
When do you call copy constructor?
How does java enable high performance?
What is methods in java?
What are the actions that can occur when a thread enters blocked state?
What is null object in java?