import javax.swing.*; //do it public class test { public static void main(String[] args) { JButton[] buttons = new JButton[10]; buttons[0] = new JButton("0"); System.out.println(buttons[0].getText()); } }