我有这样的字符串数组:
String[][][][][] map = new String[9][13][2][1][1];
当我尝试更新一个文件时,像这样:
map[0][0][1][0][1] = "true";
每个领域都在更新为“真实”,这个:
map[0][1][1][0][1]
这个:
map[0][2][1][0][1]
为什么会这样?
这是我的代码:
int UP = 0;
int UP_RIGHT = 1;
int RIGHT = 2;
int DOWN_RIGHT = 3;
int DOWN = 4;
int DOWN_LEFT = 5;
int LEFT = 6;
int LEFT_UP = 7;
String[][][][][] map = new String[9][13][2][1][1];
public PitchMoveHelper() {
String[][] move = {
{String.valueOf(UP), "false"},
{String.valueOf(UP_RIGHT), "false"},
{String.valueOf(RIGHT), "false"},
{String.valueOf(DOWN_RIGHT), "false"},
{String.valueOf(DOWN), "false"},
{String.valueOf(DOWN_LEFT), "false"},
{String.valueOf(LEFT), "false"},
{String.valueOf(LEFT_UP), "false"}
};
String[][] used = {{"used", "false"}};
for(int z = 0; z < 9; z++) {
for(int x = 0; x < 13; x++) {
map[z][x][0] = used;
map[z][x][1] = move;
}
}
//this.updateLeftBand();
//this.updateRightBand();
//this.updateTopBand();
//this.updateBottomBand();
map[0][0][1][0][1] = "true";
System.out.println(Arrays.deepToString(getPitchMap()));
}