We all use this
keyword many times explisit with our instance fields or constructor, however, this refers to* current object*, for example:
class Foo imlements ActionListener{
Foo fooObject;
public Foo(){
//....
button.addActionListener(this);//this work as we pass the current object reference as an argument
//or
button.addActionListener(fooObject);// this will compile, but the action won't fire
}
@Override
public void actionPerformed(ActionEvent){
System.out.println("Some message");
}
}
I don't understand what's current object equivelant to, what does this
means in the above example?