这些循环是什么:
while (x <= gridWidth) {
while (y <= gridHeight) {
System.out.println("X: " + x + ", Y: " + y);
y++;
}
x++;
}
输出这个:
X: 0, Y: 0
X: 0, Y: 1
X: 0, Y: 2
X: 0, Y: 3
X: 0, Y: 4
X: 0, Y: 5
X: 0, Y: 6
X: 0, Y: 7
X: 0, Y: 8
X: 0, Y: 9
X: 0, Y: 10
X: 0, Y: 11
X: 0, Y: 12
X: 0, Y: 13
X: 0, Y: 14
X: 0, Y: 15
X: 0, Y: 16
X: 0, Y: 17
X: 0, Y: 18
X: 0, Y: 19
X: 0, Y: 20
X: 0, Y: 21
X: 0, Y: 22
X: 0, Y: 23
X: 0, Y: 24
X: 0, Y: 25
X: 0, Y: 26
X: 0, Y: 27
X: 0, Y: 28
X: 0, Y: 29
X: 0, Y: 30
X: 0, Y: 31
X: 0, Y: 32
X: 0, Y: 33
X: 0, Y: 34
X: 0, Y: 35
X: 0, Y: 36
X: 0, Y: 37
X: 0, Y: 38
X: 0, Y: 39
X: 0, Y: 40
X: 0, Y: 41
X: 0, Y: 42
X: 0, Y: 43
X: 0, Y: 44
X: 0, Y: 45
X: 0, Y: 46
X: 0, Y: 47
X: 0, Y: 48
X: 0, Y: 49
X: 0, Y: 50
?
我很确定gridWidth = 50
,因为我打印了它。