0 works

Print Nested Array in Java


dashboard+ Project

Posted by @starbucks #java

Code snippet:

String[][] deepArray = new String[][] {{"John", "Mary"}, {"Alice", "Bob"}};
System.out.println(Arrays.toString(deepArray));
//output: [[Ljava.lang.String;@106d69c, [Ljava.lang.String;@52e922]
System.out.println(Arrays.deepToString(deepArray));
content_copyCopy to Clipboard

More details:

Output will look like: [[John, Mary], [Alice, Bob]]

Code snippet source:

https://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-a-java-array

>> Browse more code snippets

more_vert