これはおそらくかなり基本的な質問ですが、私が入っているクラスの別の部分から変数にアクセスできないようです。私はthis.p1、this.TwoParamRF.p1などを試しました。私はp1の価値を手に入れることができません。ありがとう。ネストされたクラスの変数へのアクセス
public class SecondMDP {
public SecondMDP(double p1, double p2) {
this.rf = new TwoParamRF(p1,p2);
}
public static class TwoParamRF implements RewardFunction {
double p1;
double p2;
public TwoParamRF(double p1, double p2) {
this.p1 = p1;
this.p2 = p2;
}
}
public String bestActions(double gamma) {
ValueIteration vi=computeValue(gamma);
alert(p1); //Getting error
alert(p2); //here
}
}
フィールド宣言は表示されませんが、 'this.rf.p1'と' this.rf.p2'だけが必要です。 – 4castle