public class GetSelectedJRadioButton implements ActionListener{//Create two radio button that will be put into a group//Set start radio button selection to femaleJRadioButton firstRadioButton=new JRadioButton("Female",true);JRadioButton secondRadioButton=new JRadioButton("Male");

//Create a button with text ( What i select )JButton button=new JButton("What i select");

//Create a window using JFrame with title ( Get selected JRadioButton )JFrame frame=new JFrame("Get selected JRadioButton");

public GetSelectedJRadioButton(){ //Create a radio button group using ButtonGroup ButtonGroup bg=new ButtonGroup();

//Add all radio button into created group bg.add(firstRadioButton); bg.add(secondRadioButton);