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 parse method?
How many threads can java run?
State the difference between creating string as new () and literal.
What happens when main () method is declared as private?
What does a boolean method return?
What does the ‘static’ keyword mean? Is it possible to override private or static method in java?
Can a method be overloaded based on different return type but same argument type?
What is native code?
Explain 5 features introduced in jdk 1.7?
What is thread life cycle in java?
How do you identify independent and dependent variables?
Is it possible to override the main method?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
What about anonymous inner classes in java?
Why map is used in java?