In Java, I have had several projects recently where I used a design pattern like this:
public abstract class A {
 public abstract int getProperty();
}
public class B extends A {
 private static final int PROPERTY = 5;
 @Override
 public int getProperty() {
  return PROPERTY;
 }
}
Then I can call the abstract method getProperty() on any member of class A. However, this seems unwieldy - it seems like there should be some way to simply override the property itself to avoid duplicating the getProperty() method in every single class which extends A.
Something like this:
public abstract class A {
 public static abstract int PROPERTY;
}
public class B extends A {
 @Override
 public static int PROPERTY = 5;
}
Is something like this possible? If so, how? Otherwise, why not?
 
     
    