Example of Arrays.deepToString in java
May 18, 2013
Arrays.deepToString in java converts multi dimensional array to string. Arrays.deepToString checks if an array has the element as an
array then it converts that array in String. String representtaions are in the format [[],[]].
DeepToStringDemo.java
package com.util; import java.util.Arrays; public class DeepToStringDemo { public static void main(String[] args) { String[][] multiDim = { {"Hello "," Ram"}, {"how ","are you."} }; String s = Arrays.deepToString(multiDim); System.out.println(s); int[][] multiDimInt = { {1,2}, {3,4} }; s = Arrays.deepToString(multiDimInt); System.out.println(s); } }
[[Hello , Ram], [how , are you.]] [[1, 2], [3, 4]]