Is the object of abstract class is created while using anonymous inner class?
Having a little trouble understanding Anonymous Inner classes
Here s the code that I have.I know that WindowAdapter class is an Abstract class, then what does the line "new WindowAdapter()" means? Are we creating an object of WindowAdapter class which is an abstract class.Confused!!!
Class Myframe extends Frame
{
public static void main(String args[])
{
Myframe f=new Myframe();
f.setVisible(true);
f.setSize(300,300);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
Having a little trouble understanding Anonymous Inner classes
Here s the code that I have.I know that WindowAdapter class is an Abstract class, then what does the line "new WindowAdapter()" means? Are we creating an object of WindowAdapter class which is an abstract class.Confused!!!
Class Myframe extends Frame
{
public static void main(String args[])
{
Myframe f=new Myframe();
f.setVisible(true);
f.setSize(300,300);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
No comments:
Post a Comment