public class ClickButton extends JButton {
private int clicks = 0;
public ClickButton() {
super("0");
this.addActionListener (e -> {
++clicks ;
this.setText(clicks + "");
});
}
}
How is the lambda expression, inside of addActionListener method, able to access the "clicks" field of my class? Is this because, I can consider Lambda-Expression as a very short initialisation of an inner class, which can of course access this field?