Encapsulation is the concept of hiding the implementation details of a class and allowing access to the class through a public interface. For this, we need to declare the instance variables of the class as private or protected. The client code should access only the public methods rather than accessing the data directly. Also, the methods should follow the Java Bean's naming convention of set and get.
Encapsulation makes it easy to maintain and modify code. The client code is not affected when the internal implementation of the code
Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts
Sunday, 25 December 2011
Wednesday, 16 November 2011
Predict the output or error(s) for the following:
#include<stdio.h>
main()
{
}
Answer:
Explanation:
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Answer:
Compiler Error
Explanation:
Subscribe to:
Posts (Atom)