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








Syntax

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

public static String toString(Object [] a)

Example

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

/*w  w w.  ja va  2s. c  o m*/

import java.util.Arrays;

public class Main {

   public static void main(String[] args) {

    Object[] ob1 = new Object[] { 10, 20 };

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

The code above generates the following result.