Java IO Tutorial - Java PrintStream.append(char c)








Syntax

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

public PrintStream append(char c)

Example

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

//from  w w  w.j ava 2  s .  c  o m

import java.io.*;

public class Main {

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

      
      PrintStream ps = new PrintStream(System.out);

      // append our characters
      ps.append(c);
      ps.append('y');
      ps.append('m');

      // print the result
      ps.flush();
      ps.close();

   }
}

The code above generates the following result.