File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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