欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

java Arrays.toString

程序员文章站 2024-03-06 22:30:26
...

对于一维数组:

String[] arrayStr = new String[]{"Java", "Node", "Python", "Ruby"};
System.out.println(Arrays.toString(arrayStr));

 Output :[Java, Node, Python, Ruby] 

对于二维数组:

String[][] arrayStr = new String[][]{{"JAVA","Node","Python"},{"C","C++","Objective-C"}};
System.out.println(Arrays.deepToString(arrStr));

  Output:[[JAVA, Node, Python], [C, C++, Objective-C]]

上一篇: java.util.*中Arrays源码详解

下一篇: