J'ai un tableau (Arr). Je remplis les points1 et 2 avec des valeurs.
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;
}
Cela fonctionne, mais qu'en est-il, lorsque j'en ai cinq ou plus (points1, points2, points3...) Comment puis-je faire "public Arr points[][]" ? Et ensuite remplir et obtenir les valeurs avec par exemple points[0][22].pointX ou points[1][10].text ?
Et comment puis-je voir le tableau de points[][] comme var_dump en PHP ? Comment lister le tableau ? Exemple de 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"
}
}