I\'m building a Challenge24Solver
class in Java. The logic itself works and finds the solutions as would be expected (with an arbitrary number of arguments). A
Static variables are referenced via the class. You have defined operator
as being of type Operation
, so operator.token
refers to Operation.token
.
I recommend using a getter for this purpose:
abstract Operation { \\ Basic operation class
abstract public double operate (double x, double y);
abstract public String getToken();
}
class AddOp extends Operation {
public double operate (double x, double y) {
return x+y;
}
public String getToken() {
return "+";
}
}