I have a question about why should we set a field final when we use it in an innerclass? for example why should we set the modifier of textField to final? My question is that why it will not be available if we do not declare it as final?
final TextField textField = new TextField();
Button b = new Button();
b.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
textField.setText("hello");
}
});