i am trying to make a code that when pressed by he user it will print out correct but instead of printing out correct it just does nothing. i have researched this topic very clearly but i cannot seem to find the right answer if any body can help me it will be greatly appreciated

```
import java.awt.FlowLayout;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JOptionPane;

public class JRadioButtonTest 
{

  public static void main(String[] args) 
  {

    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("JRadioButton Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JRadioButton button1 = new JRadioButton("0.4");
    JRadioButton button2 = new JRadioButton("12");
    JRadioButton button3 = new JRadioButton("37");

    ButtonGroup colorButtonGroup = new ButtonGroup();
    colorButtonGroup.add(button1);
    colorButtonGroup.add(button2);
    colorButtonGroup.add(button3);

    frame.add(new JLabel("what is the density of a piece of rock that is 40 grams and 25cm3"));
    frame.add(button1);
    frame.add(button2);
    frame.add(button3);
    frame.pack();
    frame.setVisible(true);

    if(button2.isSelected()){
      JOptionPane.showMessageDialog(null,"correct");
      } 
    }
  }

```