SE450: Overriding: Hiding [9/35] Previous pageContentsNext page

A declaration is hidden if another declaration of the same name occurs in the scope of the outer declaration.

public class A {
    int x;
    static void z() { ... }
public class B extends A {
    float x;                // old x still in scope, use super.x
    static int z() { ... }  // old z still in scope, use A.z()
    byte x (char x) {       // oh dear...
      char c = x;
      float f = this.x;
      int i = super.x;
      byte b = this.x();

You should avoid hiding

Previous pageContentsNext page