Java – how to print arrays easily?

See English answer > What's the simple way to print a Java array? 32

System.out.print("[");
for(int i = 0; i < arr.length; i++){
    System.out.print(arr[i] + ",");
}
System.out.println("]");

This seems to be a function built into Java (I'm using Java) Is there a built-in method to print arrays?

Solution

You can use:

For more information, see arrays docs

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>