Hi All,
I went through the specification for protected access and have got a clear understanding. I paste will below an abstract of the same.
A protected member or constructor of an object may be accessed from outside the package in which it is declared only by code that is responsible for the implementation of that object. Let C be the class in which a protected member or constructor is declared and let S be the subclass of C in whose declaration the use of the protected member or constructor occurs. Then:
If an access is of a protected member (field or method), let Id be its name. Consider then the means of qualified access:
If the access is by a field access expression of the form super.Id, then the access is permitted.
If the access is by a qualified name Q.Id, where Q is a TypeName, then the access is permitted if and only if Q is S or a subclass of S.
If the access is by a qualified name Q.Id, where Q is an ExpressionName, then the access is permitted if and only if the type of the expression Q is S or a subclass of S.
If the access is by a field access expression E.Id, where E is a Primary expression, or by a method invocation expression E.Id(. . .), where E is a Primary expression, then the access is permitted if and only if the type of E is S or a subclass of S.
Otherwise, if an access is of a protected constructor:
If the access is by a superclass constructor invocation super(. . .), then the access is permitted.
If the access is by a class instance creation expression new T(. . .), then the access is not permitted. (A protected constructor can be accessed by a class instance creation expression only from within the package in which it is defined.)
If the access is by an invocation of the method newInstance of class Class (�20.3.6), then the access is not permitted.
Thanks to all for trying to help me out
reshma