when do you need setters and getters inheritance java code example
Example 1: inheritance setter and getter in java
C1.x = 1
C2.x = 1
C3.x = 1
C4.x = 4
Example 2: inheritance setter and getter in java
public class B extends A {
@Override
public final int getA() {
return super.getA();
}
@Override
public final void setA(int value) {
super.setA(value);
}
}