The following is from JWhiz, test 1 Q3
Answers given are:
A. Compilation error at line 9
B. Compilation error at line 5
C. Runtime error at line 11
D. None of the above.
The answer is given as D as there will be a compilation error at line 11 as objX is not allowed to access any protected member of the SuperclassX.
Now, what has me baffled is that protected members " .. are accessible....by all subclasses of this class in any package where this class is visible." (from KM). The more that I look at this the more my head spins, can somebody please explain it to me?