Java PrintStream.print(char c)

Syntax

PrintStream.print(char c) has the following syntax.

public void print(char c)

Example

In the following code shows how to use PrintStream.print(char c) method.


/*  w  w w  .  j  a v  a2 s  .co m*/
import java.io.*;

public class Main {

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

      
      PrintStream ps = new PrintStream(System.out);

      // print char
      ps.print(c);
      ps.print('b');

      // flush the stream
      ps.flush();

   }
}

The code above generates the following result.