This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Doubt on interface instantiation in ActionListener class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Doubt on interface instantiation in ActionListener class

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
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

Joined: Jan 10, 2002
Posts: 61310
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Doubt on interface instantiation in ActionListener class