Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anonymous Inner Class

 
vidhya Ramachandran
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.event.*;
does that help?
[This message has been edited by Peter Lyons (edited November 03, 2000).]
 
vidhya Ramachandran
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it did compile when I changed to
import java.awt.event.*;
class s extends java.awt.Frame{
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic