wood burning stoves 2.0*
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Protected Access" Watch "Protected Access" New topic
Author

Protected Access

henley
Greenhorn

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?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi!
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Protected Access