title: Java - Message when closing JFrame Window
body: <p>I have a Java Program containing a class <strong>Application</strong> inheriting from JFrame.</p>
  
  <p>I want to display a message which asks the user if he wants to exit the program upon clicking the X button at the top right of the window.</p>
  
  <p>This is my code so far:</p>
  
  <p>I got this code from a tutorial I found online.  I coded the WindowClosing event handler myself.  However, I have trouble registering the window listener (addWindowListener).  It is telling me that WindowAdapter is abstract and cannot be instantiated.</p>
  
  <p>How can I solve this problem please?</p>