Inheritance
 
Hiding Member Variables
 
The member variables defined in the subclass hide member variables of the same name in the superclass.
One interesting feature of Java member variables is that a class can access a hidden member variable through its superclass.
 
Consider this superclass and subclass pair:
 
class Super
{
Number aNumber;
}
class Sub extends Super
{
Float aNumber;
}
 
The aNumber variable in Sub hides aNumber in Super. But we can access aNumber from the superclass with:
 
super.aNumber
super is a Java language keyword that allows a method to refer to hidden variables and overriden methods of the superclass.