What is meant by Encapsulation? Can you write a class to
explain encapsulation?
Answer Posted / sivakishorereddy(badvel)
-Encapsulation is wrapping of data(Data members) and
associated methods(member functions) into a single unit in
such a way that data can be accessed with the help of
associated methods.
--In a class we can specify the variables(Data members) as
private. So for other classes it will not be accessible.
--Through methods(member functions) only we can access the
member variables or modify them.
--It gives more security for our data. It is nothing but
data hiding.
| Is This Answer Correct ? | 19 Yes | 1 No |
Post New Answer View All Answers
Define immutable object?
Explain notify() method of object class ?
How do you use find and replace?
What is an class?
Should database connections be singleton?
Is simpledateformat safe to use in the multithreaded program?
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
Can we declare an array without size in java?
Can we force the garbage collection to run?
What is the argument in java?
Explain how hashmap works?
What is the biggest integer?
Define how does a try statement determine which catch clause should be used to handle an exception?
how to create multithreaded program? : Java thread
Does constructor creates the object ?