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
Explain about instanceof operator in java?
What are the three parts of a lambda expression? What is the type of lambda expression?
What is jit compiler in java?
How do I enable java in safari?
Does java isempty check for null?
Justify your answer that you can't define a method inside another method in java, if you can then how?
How to disable caching on back button of the browser?
Is 0 an irrational number?
What are different ways of object creation in java ?
What is volatile keyword in java
How can an exception be thrown manually by a programmer?
What is command line argument in java?
Why javac is not recognized?
What is instance example?
Difference between error and exception