for (int i = 0; i < 9; i++) {
try {
inputLine = read.readLine();
} catch (IOException e) {
throw new MapException("the file input does not exist");
}
for (int j = 0; j < 5; j++) {
char x = inputLine.charAt(j);
String y = Character.toString(x);
theMap[j][i] = y;
if (x == '.') {
nodeNum++;
}
if (x == 'S') {
startingPoint = nodeNum;
nodeNum++;
}
if (x == 'D') {
destinationNode = nodeNum;
nodeNum;
}
}
}
外部for循环只运行一次 . 经过一些测试后,我得出结论,代码在完成内部for循环后才会终止 . 我无法弄清楚为什么会这样 . 一些帮助会很精彩 .