February 2017
Beginner
1056 pages
28h 57m
English
In this text, we always use the modifiers public and private before instance variables and method definitions. Normally, these are the only modifiers you need, but there are two other possibilities that fall between the two extremes of public and private. In this appendix, we discuss the modifier protected as well as the restriction that applies when you use no modifier at all.
If a method or instance variable is modified by protected rather than public or private, it can be accessed directly by name within
Its own class definition
Any descendant class
Any method definition for any class in the same package
That is the extent of the access; the protected method or instance variable cannot be accessed ...
Read now
Unlock full access