I have a P4 class in the default package (I know that using the default package is bad practice, but just βfor exampleβ at the moment):
import temp.P2; public class P4 extends P2 { public void someMethod() { P2 p2 = new P2();
and class P2 in the temp package
package temp; public class P2 { protected void p2protected() { ... } public void p2public() { ... } void p2default() { ... } }
From the access control mechanism , I would expect P4 - with extended P2 should be able to see the protected member of my superclass even outside the package as soon as it imports the namespace of this package.
What am I missing?
TIA.
source share