Java Collection Tutorial - Java Arrays.toString(int[] a)








Syntax

Arrays.toString(int[] a) has the following syntax.

public static String toString(int[] a)

Example

In the following code shows how to use Arrays.toString(int[] a) method.

/*from  w  ww.  j  a va2 s .co  m*/
import java.util.Arrays;

public class Main {

   public static void main(String[] args) {

    int[] i1 = new int[] { 3, 12, 98 };

    System.out.println(Arrays.toString(i1));    
  }
}

The code above generates the following result.