我的主要目标是通过按不同的三个按钮获得分数,一轮一轮累计直到达到目标分数即为成功。
以下是我的java代码块
public static void main(String args[]){
FirstFrame game = new FirstFrame();
game.init();
int goal=10;
int current = 0;
while (current<goal){
game.one.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
current+=1;
}
});
}
}
运行以上代码后的error提示为
Variable 'current' is accessed from within inner class, needs to be final or effectively final
以下是我的awt界面