Explain in detail about encapsulation with an example?

Answer Posted / sanjay singh chauhan

it is way to combine field and mathod in a single entity
like a capsule ;
class A
{
int i;
void m(int i)
{
//body of this mathod ;
}
}
like this way;

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does enum work in java?

532


Explain the public class modifier?

490


What is callablestatement? How you can call stored procedure to pass in parameter?

533


Is main a keyword in java?

527


What are byte codes?

640






Can we overload the methods by making them static?

489


What is replaceall in java?

536


Can we have 2 main methods in java class?

529


Why do we need singleton class?

538


What do you mean by inner class in java?

556


Can an abstract class be a final class?

516


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

576


Can we override private method in java?

605


If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?

652


What is meant by main method?

567