I'm fairly new to programming but I've taken the Intro CS class at my school, so I understand most of the basics (or thought I did). I'm trying to teach myself some OpenGL via JOGL and I came across a few lines of code that I couldn't understand. Am I missing something?
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
I checked the Javadoc, and
WindowAdapter
is an abstract class. So how can he be instantiating it?Or is this even creating an instance?
It almost looks like the code extends
WindowAdapter
or overrides thewindowClosing
method, but how is that possible without writing a new class?