Based on the answers from this question, given that I have a class with fields initialized on the declaration, what should I do when I extend that class and need the subclass to have a different default value?
Should I assign the new default value in the constructor of the subclass and keep the assignment in the declaration for the superclass?:
public class Bird {
private boolean flight = true;
}
public class Penguin extends Bird {
public Penguin() {
flight = false;
}
}
Or should I refactor so that both classes initialize fields in the constructor?
From the answers in this question it looks like there are no significant technical differences, so this is a question about semantics.