I'm a student trying to figure out how to fix a seemingly simple problem. I keep getting an error while trying to initialize 2 variables in a FOR loop. I'm trying to create rows for a game board. Why am I getting this error?
This is the method:
public String [] board;
public void printBoard(){
for(int i, j = 0; i < this.board.length; i++, j++)
if(j > 10)
System.out.println();
else
System.out.print(this.board[i]);
> java:39: error: variable i might not have been initialized