import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class MainClass { public static void main(String[] argv) { ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("The action has occurred"); } }; } }