O'Reilly logo
  • Michael ss thinks this is interesting:

We call the addWindowListener method on the current object instance. (Note that the this object reference is implicit in the current context.) The addWindowListener requires an object reference as a parameter. The object reference refers to the object that will listen to window events generated by the current object. We create this object reference by instantiating the WindowAdapter class. Immediately following this instantiation, we write the code to override the windowClosing method. Note that we did not create a class that extends the WindowAdapter class. However, the compiler would generate a separate class for this WindowAdapter code. This class is anonymous because we have not nam...


Cover of Java Programming