I was curious about how the implements
keyword works, and I was hoping someone could explain to me, where does the implemented method get called on?
For example let's say I have a class that implements ActionListener
. It now implements the
public void actionPerformed(ActionEvent e) {
}
method. I have a button that is binded to this ActionListener
. But how does it call on this method? How does it know my class implements this method.
This is called "dynamic binding" in Java. You can read this on details here, for example http://www.studytonight.com/java/dynamic-method-dispatch.php