Monday, May 2, 2016

Simplest way to print array content in Java

The simplest way to print array contents in Java is using the methods from the utility class Arrays. Methods below are available since Java 5 (1.5).
int[] prim = { 0, 1, 2, 3, 4 };

System.out.println(Arrays.toString(prim));

No comments: