Answer:

The work in progress is shown below.

Two Buttons

Now two buttons are added to the class. Call one button redButton and the other grnButton.

import java.awt.*; 
import java.awt.event.*;
import javax.swing.*; 

public class TwoButtons extends  JFrame implements  ActionListener
{


  . . . . more code will go here . . . . 

  public static void main ( String[] args )
  {
    TwoButtons demo  = new TwoButtons()  ;
    

    . . . . more code will go here . . . . 
    
    demo.setSize( 200, 150 );     
    demo.setVisible( true );      

  }
}

. . . . more code will go here . . . . 

QUESTION 5:

Decide where in the program the button definitions should go.