variable hiding in Java

As when hiding a static method, you can’t override a variable; you can only hide it. Also similar to hiding a static method, the rules for accessing the parent and child variables are quite similar. If you’re referencing the variable from within the parent class, the variable defi ned in the parent class is used. Alternatively, if you’re referencing the variable from within a child class, the variable defi ned in the child class is used. Likewise, you can refeence the parent value of the variable with an explicit use of the super keyword.