char[][] boardGame = new char[10][10];
// this is suppose to create an array object
for (char[] row : boardGame)
{
Arrays.fill(row, 'a');
}
// this is suppose to fill the row in array with the char '*'
// and im using "Enhanced" for loops
for (int i = 0; i < boardGame.length; i++)
{
for (int j = 0; j < boardGame[i].length; j++)
{
System.out.print("|" + boardGame[i][j] + "|");
}
// in the for loop above isn't "i" and "j" been overwrite with
// numbers as I declare it int i = 0 and I update it if the
// condition is true i++
// how come it print|*||*||*||*||*|....instead of |1||2||3|...?
System.out.println();
}
Во внутреннем цикле for
выше, «я» и «J» были перезаписаны с числами, как я объявить его int i = 0
и я обновить его, если условие true
i++
.спутанность массива
Почему он печатает |*||*||*||*||*|...
вместо |1||2||3|...
?
Что вы хотите нам сказать? – smttsp
Каков ваш вопрос ?! http://stackoverflow.com/help/how-to-ask – SamTebbs33
Я не понимаю, почему вы ожидаете, что он будет печатать цифры вместо звездочек. – Henry