Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class TicTacToeV1 implements ActionListener { /*Instance Variables*/ priv

ID: 3553233 • Letter: P

Question

 public class TicTacToeV1 implements ActionListener { /*Instance Variables*/ private JFrame window = new JFrame("Tic-Tac-Toe"); private JButton button1 = new JButton("x"); private JButton button2 = new JButton("x"); private JButton button3 = new JButton("x"); private JButton button4 = new JButton("x"); private JButton button5 = new JButton("x"); private JButton button6 = new JButton("x"); private JButton button7 = new JButton("x"); private JButton button8 = new JButton("x"); private JButton button9 = new JButton("x");    public TicTacToeV1(){  /*Create Window*/ window.setSize(300,300); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setLayout(new GridLayout(3,3));  /*Add Buttons To The Window*/ window.add(button1); window.add(button2); window.add(button3); window.add(button4); window.add(button5); window.add(button6); window.add(button7); window.add(button8); window.add(button9);  /*Add The Action Listener To The Buttons*/ button1.addActionListener(this); button2.addActionListener(this); button3.addActionListener(this); button4.addActionListener(this); button5.addActionListener(this); button6.addActionListener(this); button7.addActionListener(this); button8.addActionListener(this); button9.addActionListener(this);  /*Make The Window Visible*/ window.setVisible(true); }  public void actionPerformed(ActionEvent a) { System.out.println("A button was pressed.");  }  public static void main(String[] args){ new TicTacToeV1(); } } 

Explanation / Answer

Fine the same here : http://ideone.com/PTSe4W