What does this code mean here:
private ActionListener doGreeting = new ActionListener {
public void actionPerformed(ActionEvent e) {
myGreetingField.setText("Hello");
}
};
I read somewhere that it is a form of callback but I don't understand what it means. Can someone please explain this and/or provide some sources where it explains it in detail?
EDIT: My reason for asking this question is to understand what this means in Android Studio:
sumButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{
String a = et1.getText().toString();
String b = et2.getText().toString();
int sum = Integer.parseInt(a) + Integer.parseInt(b);
Toast.makeText(getApplicationContext(), String.valueOf(sum), Toast.LENGTH_LONG).show();
}
});
where we have this format: function1(new Class.function2(){...}); The code above even has another function inside fucntion2 (onClick is inside OnClickListner). Can Someone please clear this up?