I have this (partially pseudo)code
class a {
void b()
{
int d = 0;
JButton c = new JButton();
c.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
d = 1;
}
});
}
}
However, it doesn’t work, eclipse suggested adding final identifier to d, but that makes value impossible to change. Sorry if it’s a stupid question, but it’s hard to form a question for Google for something like this…
I also can’t declare variable on lever higher than method b.
You probably want to move declaration of d outside of the method.
..and format your code.