It is true.
Since you didn't explicitly specify C#i
visibility, this means it has default
visibility, which means only package visibility. It is different from protected
in the way that such fields (or methods or classes or whatever) are not inherited, thus default
visibility is more restrictive than protected
.
So doing this.i
in D
is valid as long as C
and D
are in the same package. Otherwise, even if D extends C
, C#i
is not visible because it has default
visibility (which is not inherited).
See the documentation for all visibility modifiers and how they work.