I have an abstract superclass called operation.java and several subclasses extending this class and representing operations. Each such subclass should contain an array of normalizing contants which should be static because it holds globally. I have the following example:
abstract class Operation {
private static double[] normalizingConstants;
protected Operation() {
normalizingConstants = new double[10];
}
}
class AddOp extends Operation {
protected AddOp() {
super();
}
}
class MinusOp extends Operation {
protected AddOp() {
super();
}
}
Does each subclass hold its own static normalizingConstants? If I call AddOp.normalizingConstants[0]
and MinusOp.normalizingConstant[0]
I want different results. How can this be achieved?