Jbutton Actionperformed

JButton button = new JButton("Click me");
button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("button was clicked!");
    }
}
Davido Tonante