Overriding a super class's instance variables

He perhaps meant to try and override the value used to initialize the variable. For example,

Instead of this (which is illegal)

public abstract class A {
    String help = "**no help defined -- somebody should change that***";
    // ...
}
// ...
public class B extends A {
    // ILLEGAL
    @Override
    String help = "some fancy help message for B";
    // ...
}

One should do

public abstract class A {
    public String getHelp() {
        return "**no help defined -- somebody should change that***";
    }
    // ...
}
// ...
public class B extends A {
    @Override
    public String getHelp() {
        return "some fancy help message for B";
    // ...
}

Because if you changed the implementation of a data member it would quite possibly break the superclass (imagine changing a superclass's data member from a float to a String).


Because you can only override behavior and not structure. Structure is set in stone once an object has been created and memory has been allocated for it. Of course this is usually true in statically typed languages.