Describe how to modify code


Problem:

Question- How would you modify it? Can you post the modified the code?

class ButtonExample implements ActionListener

{

JButton button1 = new JButton ("Button 1");

JButton button2 = new JButton ("Button 2");

public void actionPerformed(ActionEvent event)

{

System.out.println("I listened");

 }

button1.addActionListener(this);

button2.addActionListener(this);

 }

 

Please explain the modified code.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Describe how to modify code
Reference No:- TGS0892868

Expected delivery within 24 Hours