File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Protected Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Protected Access" Watch "Protected Access" New topic

Protected Access


Joined: Jul 06, 2000
Posts: 16
I thought I remembered reading that protected fields/methods were accessible to only one level of subclasses. When I recently tested that, I found that it was not true. Does anyone else remember reading that in some book and if so which book?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
protected varibles/methods can be accessible from the same class,sub classes in the same package, other classes in the same package and sub classes in other packages.
i dont know from which book i found it but i read it in some book.
I agree. Here's the link:
subject: Protected Access
It's not a secret anymore!