0

Below is my code:

public class Test2 {
    public static void main(String args[]){

    String[][] a = {
        {"type"},
        {"emergency"},
        {"manual"},
        {"brand"},
        {"accessGroup"},
        {"memberRef"}             
    };

    String[][] b = {
            {"ab"},
            {"cd"},
            {"ef"},
            {"gh"},
            {"ij"},
            {"kl"}             
        };

    ArrayList<String[][]> al = new ArrayList<String[][]>();
    al.add(a);
    al.add(b);
    Iterator<String[][]> itr = al.iterator();
    while(itr.hasNext()){
    System.out.println(itr.next()); //prints: [[Ljava.lang.String;@2a139a55
    }
    }
 }

The problem here is that the 2D array is inside an ArrayList, and I am not sure on how to use 2 for loops to scan through each elements and print it. Could anyone help? Thanks in advance.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Harish Harry
  • 45
  • 1
  • 7

0 Answers0