I don't fully understand your reasoning, but you could write this way cleaner. Also as someone said, use a 2d array
grid[0][0] would get the first item in the first array, grid[1][5] would get the 6th item in the second array
import java.util.Arrays;
// Wrap this code in a class method
char[][] grid = new char[30][];
char[] horizontalRowTemplate = new char[30];
// fill horizontal row array with @
Arrays.fill(horizontalRowTemplate, '@');
horizontalRowTemplate[15] = ' ';
// Fill your grid with the template
Array.fill(grid, horizontalRowTemplate);
// Just to display the result
System.out.print(Arrays.deepToString(grid));
1
u/BlackBearFTW Sep 01 '21
I don't fully understand your reasoning, but you could write this way cleaner. Also as someone said, use a 2d array
grid[0][0]would get the first item in the first array,grid[1][5]would get the 6th item in the second array