Java IO Tutorial - 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.

//from   ww w.  ja  va2  s .c o  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.