Understanding Java’s protected modifier
What’s going on here? You’ve misunderstood the meaning of protected. You can access the protected members declared in A from within C, but only for instances of C or subclasses of C. See section 6.6.2 of the JLS for details of protected access. In particular: Let C be the class in which a protected member … Read more