The protected access specifier requires that the protected member is visible in a subclass outside the package only as inherited member of the subclass.
works absolutely fine.....
However when you are using the Parent reference, the member varriable x is being accessed as an instance varriable of Parent class and not as a varriable inherited by Child from Parent. So you get the complier error.
If debugging is the process of removing bugs, then programming must be the process of putting them in. -- Edsger Dijkstra