aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Anonymous Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Anonymous Inner Class" Watch "Anonymous Inner Class" New topic
Author

Anonymous Inner Class

vidhya Ramachandran
Greenhorn

Joined: Sep 15, 2000
Posts: 13

import java.awt.*;
class s extends Frame{
s(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.out.println("Anonymous Inner Class");
}});
}
public static void main(String args[]){
new s();
}
}
I am getting compiler error for the above code. Any idea why.
-------
s.java:10: Class WindowAdapter not found.
addWindowListener(new WindowAdapter()
-------

Peter Lyons
Ranch Hand

Joined: Sep 12, 2000
Posts: 202
import java.awt.event.*;
does that help?
[This message has been edited by Peter Lyons (edited November 03, 2000).]
vidhya Ramachandran
Greenhorn

Joined: Sep 15, 2000
Posts: 13
Yes it did compile when I changed to
import java.awt.event.*;
class s extends java.awt.Frame{
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous Inner Class
 
Similar Threads
Anonymous inner classes
Catching Window Closing event
Anonymous Inner Class
What are adapter classes and why are they used ?!!
Inside Anonymous inner class, we can access Outer class object ?