上代码先:
String array[][]={{"hello","haha"},{"nishi","nihao"},{"woshi","wohao"}};
System.out.println(Arrays.toString(array));
System.out.println(Arrays.deepToString(array));
看看结果:
[[Ljava.lang.String;@153f67e, [Ljava.lang.String;@15bdc50, [Ljava.lang.String;@1dd3812]
[[hello, haha], [nishi, nihao], [woshi, wohao]]
很明显了,deepToString()是解决嵌套数组的问题的。