[Solved] Display char instead of 0 in 2D Java array


If you want to print hyphens instead of zeroes, then simply print hyphens instead of zeroes.

So instead of this:

System.out.print(scoreArray[x][y]);

you might write this:

if(scoreArray[x][y] == 0)
    System.out.print("-");
else
    System.out.print(scoreArray[x][y]);

Your question doesn’t include the code that prints the array so I can’t be more specific to your code.

1

solved Display char instead of 0 in 2D Java array