Java IO Tutorial - Java PrintWriter.print(char[] s)








Syntax

PrintWriter.print(char[] s) has the following syntax.

public void print(char[] s)

Example

In the following code shows how to use PrintWriter.print(char[] s) method.

/*from   ww w  .  j  ava  2  s.c o  m*/
import java.io.*;

public class Main {

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

      
      PrintWriter pw = new PrintWriter(System.out);

      // print char array
      pw.print(c);

      // flush the writer
      pw.flush();

   }
}

The code above generates the following result.