Home » array » What’s the simplest way to print an array?

What’s the simplest way to print an array?

In Java 5 Arrays.toString(arr) or Arrays.deepToString(arr) for arrays within arrays. and add Note that Object[] version calls .toString() of each object in array. If my memory serves me correct, the output is even decorated in the exact way you’re asking.

Edit: Don’t forget to add import java.util.Arrays; like this:

package packageName;
import java.util.Arrays;
...

http://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-an-array

Leave a comment