Issue
I have several arrays, I add them to a list of arrays, and then I want to print this list. How can I do this?
List<String[]> kList = new ArrayList<String[]>();
kList.add(anArray);
kList.add(anArray2);
System.out.println(kList);//how to print it?
Solution
If you are using Java 8+ you can use :
kList.forEach(array -> System.out.println(Arrays.toString(array)));
Before Java 8 :
for(String[] array : kList) {
System.out.println(Arrays.toString(array));
}
Answered By - YCF_L
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)