[Ljava.lang.String;@372f7a8d [Ljava.lang.String;@2f92e0f4 [Ljava.lang.String;@28a418fc
3 Réponses :
Vous devez ajouter une autre boucle à l'intérieur de la première boucle car vous avez une liste de matrices de tableau p>
Vous obtenez une sortie comme celle-ci car vous essayez d'imprimer une référence de matrice de chaîne, au lieu de String.try the Code ci-dessous.
public class list{ public static void main(String[] args) { ArrayList<String[]> rows = new ArrayList<>(); rows.add(new String[]{"1","2","3"}); rows.add(new String[]{"1","2"}); rows.add(new String[]{"1"}); for (String[] now : rows) { for(int i = 0 ; i < now.length ; i++){//Printing the current array elements System.out.println(now[i]); } } } }
Si vous souhaitez imprimer tous les éléments des tableaux:
Solution 1: P>
for (String[] now : rows) { for (String i : now) { System.out.println(i); } }
Essayez d'utiliser
system.out.println (java.util.arrays.tostring (maintenant)); code>