Why can’t my subclass access a protected variable of its superclass, when it’s in a different package?
It works, but only you the children tries to access it own variable, not variable of other instance ( even if it belongs to the same inheritance tree ). See this sample code to understand it better: //in Parent.java package parentpackage; public class Parent { protected String parentVariable = “whatever”;// define protected variable } // … Read more