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 is sizeof () operator?
What is purpose of keyword void?
List the different types of classloaders in java.
What are Normalization Rules? Define Normalization?
Which containers use a flowlayout as their default layout in java programming?
How to split arraylist elements in java?
What is abstract class constructor called?
List the interfaces which extends collection interface?
What a static class can contains?
Can a private method be declared as static?
What is byte data type?
How to print nodes of a Binary tree?
What modifiers are allowed for methods in an interface?
What is the use of System class?
What is parameter example?