Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
    Bookmark Topic Watch Topic
  • New Topic

Doubt on interface instantiation in ActionListener class  RSS feed

 
satya sahu
Ranch Hand
Posts: 97
  • 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
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
Boost this thread!