Im trying to print this 2d array
public class TicTacToe {
public static void main(String[] args) {
char[][] gameBoard = {
{' ' + '|' + ' ' + '|' + ' '},
{'-' + '+' + ' ' + '+' + '-'},
{' ' + '|' + ' ' + '|' + ' '},
{'-' + '+' + ' ' + '+' + '-'},
{' ' + '|' + ' ' + '|' + ' '}
};
for(char[] row : gameBoard){
for(char symbol : row){
System.out.print(symbol);
}
System.out.println();
}
}
}
however my output is just
Ř Ð Ř Ð Ř
What am i doing wrong? I used a youtube video to help and they did practically the same thing and it worked fine for them.
new int[]{1 + 2 + 3}ornew int[]{1, 2, 3}? If it is the latter, why do you use a different approach in your code?