I am trying to create a list of random colors using a random generator, which will be used to create a game where the user memorizes the colors. The issue is that my list of colors keeps printing with brackets around it. Any help finding a solution to this is much appreciated!
import java.util.Random;
import javax.swing.JOptionPane;
import java.util.Arrays;
public class Mission13Rivera
{
public static void main (String[] args)
{
//Opening Dialog
MemoryGame mG = new MemoryGame ();
Random r = new Random();
String[] colors = {"red", "white", "yellow", "green", "blue", "orange", "purple", "black", "pink", "gray"};
String[] solution = new String[6];
for (int i = 0; i < solution.length; i++)
{
solution[i] = colors[r.nextInt(10)];
}
JOptionPane.showMessageDialog(null,"The colors are: " + `Arrays.toString(solution));`
}
}
The result should look like... "The colors are: green, yellow, purple, pink, blue" or whatever other random number combination.