Hi,
I have doubt regarding protected modifier.
as per definition, the visibility of "protected" and "default" are
Visible to the package and all subclasses (protected).
Visible to the package-the (unfortunate) default. No modifiers are
needed.
My doubt is when "default" field/method is visible to package, it might
also visible to sub-class as well. then why "protected" is required?
Or is it so that, one class can become sub-class of a super-class from
other package?
Thanks in advance.
Suresh
Adam Maass - 24 May 2006 02:54 GMT
> Hi,
>
[quoted text clipped - 10 lines]
> Or is it so that, one class can become sub-class of a super-class from
> other package?
"default" is visible to all classes in the same package, whether subclass of
the current class or not. "protected" is visible to all classes in the same
package, as well as subclasses in other packages.
-- Adam Maass
Suresh - 24 May 2006 18:12 GMT
Thanks Adam,
your explanation makes me more clear on this topic