Tuesday, January 5, 2010

Difference between Protected and Default members - Java

The protected and default access control levels are almost identical with one critical difference. A default memeber can be accessed only if the class accessing the members belong to the same package, whereas a protected member can be accessed [only through inheritence] by a sub class even if the subclass is in a different package.

No comments:

Total Pageviews