我有一個數組(Arr)。我用值填充points1和points2。Java - 將值添加到二維數組以及如何查看數組?
public class Arr {
float pointX;
float pointY;
boolean yesNo;
String text;
}
public Arr points1[];
public Arr points2[];
points1 = new Arr[100];
for (int i = 0; i < 100; i++) points1[i]= new Arr();
for (int j = 0; j < 100; j++) {
points1[j].pointX = getFloat;
points1[j].pointY = getFloat;
points1[j].yesNo = getBoolean;
points1[j].text = getText;
}
points2 = new Arr[100];
for (int x = 0; x < 100; x++) points2[x]= new Arr();
for (int y = 0; y < 100; y++) {
points2[y].pointX = getFloat;
points2[y].pointY = getFloat;
points2[y].yesNo = getBoolean;
points2[y].text = getText;
}
這工作,但什麼是,當我對他們有五個或更多(points1,points2,points3 ...) 我怎樣才能讓 「公共編曲點[] []」?然後填寫並用例如points [0] [22] .pointX或points [1] [10] .text?
我怎樣才能在PHP中看到類似var_dump的點[] []數組?如何列出數組? 的var_dump例如:
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}
這並不完全清楚,我想什麼OP來實現,但正如斯特凡說,我肯定會用各種Java的一個去地圖... – 2013-02-28 11:28:12