Subclasses can access protected members by inheritance. So an instance of the subclass can access it's own protected member from the superclass, but it can't access the same member on a different object. Your example neatly demonstrates exactly what this means - line 27 compiles but line 24 doesn't.
Sathiesh Kumar Vs
Joined: Oct 24, 2010
As Mathew said, you are trying to access the protected variable on the reference of the Super class, which you cannot do.
This is as well same as OtherSubClassA not extending ClassA.