File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

Doubt on interface instantiation in ActionListener class

 
satya sahu
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
jButton2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){

}
});
ActionListener is an interface. Interfaces can't be instantiated. Then how in the above anonymous implementation new of the interface is done?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic