displaying a twodimensional array
publicvoid printGrid()
{
for (int i = 0; i < gridSize; i++)
{
for(int j = 0; j < gridSize; j++)
{
System.out.println = grid[i][j];
}
}
}
i need help in displaying the information on a grid, the above code is just part of the code i'm working on,it is a two dimensional array, but i can't get the grid to display it's value as below
_ _ _ _ _
_ _ _ _ _
_ _ _ _ _
_ _ _ _ _
_ _ _ _ _
can someone help me out please.
thanks
Message was edited by:
marxy007
[950 byte] By [
marxy007a] at [2007-11-27 10:59:00]

> [code]
> public void printGrid()
>{
>for (int i = 0; i < gridSize; i++)
>{
>for(int j = 0; j < gridSize; j++)
>{
> System.out.println = grid[j];
>
>
>}
> ode]
> i need help in displaying the information on a grid,
> the above code is just part of the code i'm working
> on,it is a two dimensional array, but i can't get the
> grid to display it's value as below
>
> _ _ _ _ _
> _ _ _ _ _
> _ _ _ _ _
> _ _ _ _ _
> _ _ _ _ _
>
> can someone help me out please.
>
> thanks
>
> Message was edited by:
> marxy007
What are you getting instead? Make sure GridSize is not 0;
Java 6 has a Console class for console print formatting:
http://java.sun.com/javase/6/docs/api/java/io/Console.html
Without it you might have to goof your way around with:
System.out.println("" + number + "\t");