Java IO Tutorial - Java PrintStream.println(char[] charArray)








Syntax

PrintStream.println(char[] x) has the following syntax.

public void println(char[] x)

Example

In the following code shows how to use PrintStream.println(char[] x) method.

import java.io.*;
//from   w ww. j a  v a 2s . co  m
public class Main {

   public static void main(String[] args) {
      char[] c = {'a', 'b', 'c'};

      
      PrintStream ps = new PrintStream(System.out);

      // print an array and change line
      ps.println(c);
      ps.print("from java2s.com");

      // flush the stream
      ps.flush();


   }
}

The code above generates the following result.