File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Anonymous Inner Class" Watch "Anonymous Inner Class" New topic

Anonymous Inner Class

vidhya Ramachandran

Joined: Sep 15, 2000
Posts: 13

import java.awt.*;
class s extends Frame{
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.
------- 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

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:
subject: Anonymous Inner Class
It's not a secret anymore!