Java StringWriter.write(int c)

Syntax

StringWriter.write(int c) has the following syntax.

public void write(int c)

Example

In the following code shows how to use StringWriter.write(int c) method.


// w  ww.  j av  a 2 s  . co  m

import java.io.*;

public class Main {

   public static void main(String[] args) {

      
      StringWriter sw = new StringWriter();

      // write integers that correspond to ascii code
      sw.write(70);
      sw.write(76);

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


   }
}

The code above generates the following result.