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








Syntax

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

public static String toString(char[] a)

Example

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

/*from w  ww  . j a v a 2 s .  c  o m*/

import java.util.Arrays;

public class Main {

   public static void main(String[] args) {

    // initializing char array
    char[] c1 = new char[] { 'd', 'e', 'f' };

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

The code above generates the following result.