Java - Best way to print 2D array?

前端 未结 12 782
庸人自扰
庸人自扰 2020-11-22 15:07

I was wondering what the best way of printing a 2D array was. This is some code that I have and I was just wondering if this is good practice or not. Also correct me in any

12条回答
  •  旧巷少年郎
    2020-11-22 16:03

    From Oracle Offical Java 8 Doc:

    public static String deepToString(Object[] a)

    Returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings.

提交回复
热议问题