title: How do the predefined interfaces in java work?
body: <p>This question is not about how to use interfaces, it is about how some of the predefined interfaces in java work.</p>
  
  <p>For example consider the ActionListener interface from <code>java.awt.event</code> package. When we implement the interface, then we must define the actionPerformed() method which will be called when an <code>action</code> occurs.</p>
  
  <p>What I want to know is how does this work. we aren't writing any code that checks for action occuring and which then calls actionPerformed. Neither is the code in the interface. It happens automatically.</p>
  
  <p>Who is actually doing this work? </p>