Java StringWriter.append(char c)

Syntax

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

public StringWriter append(char c)

Example

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


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

import java.io.*;

public class Main {

   public static void main(String[] args) {
      
      StringWriter sw = new StringWriter();

      // append a char       
      System.out.println(sw.append("a"));
      System.out.println(sw.append("b"));

      System.out.println(sw.toString());
   }
}

The code above generates the following result.