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
  • 51,886
  • 29
  • 155
  • 197

0 Answers0