Modifier Class Package Subclass World
public Y Y Y Y
protected Y Y Y N
no modifier Y Y N N
private Y N N N
No modifier (default modifier) is accessible from the same package only and not with the subclass.
What if the subclass is in the same package? Will it be accessible to the subclass?
Yes. The “and not with the subclass” is just “it’s not automatically accessible to the subclass” – it’s not like it’s explicitly prevented from being accessible to subclasses.
See the Java Language Specification section 6.6 for precise details. In particular: