The idea of the code is that this code below is all in an act method in the world. When the button Answerbutton1 is clicked it prompts the user to input 2 strings. It then changes the strings into characters to shorten them to the 1 letter. The next bit of code is where i try to add each of the letters and symbols in a pairing into the 2d array. Then the next if statement is a button where it outputs first the letter then the symbol. However when i click it all it outputs is just null repeatedly and none of the pairings at all after ive entered them and clicked the button
I would like to know what's wrong with the code.
String[][] array = new String [26] [2];
int n = -1;
if(Greenfoot.mouseClicked(Answerbutton1))
{
String symbol = JOptionPane.showInputDialog("Enter the symbol which you would like to change");
String letter = JOptionPane.showInputDialog("Enter the letter which you would like to input");
char symbol1 = symbol.charAt(0);
char letter1 = letter.charAt(0);
String USERsymbol = Character.toString(symbol1);
String USERletter = Character.toString(letter1);
n = n + 1;
array [n] [0] = USERletter;
array [n] [1] = USERsymbol;
}
if(Greenfoot.mouseClicked(Pairings))
{
for (int i=0 ; i <= 5; i++)
{
for(int j=0 ; j <= 1 ; j++)
{
System.out.println(array [i] [j]);
}
}
}


