Java StringWriter.write(char[] cbuf, int off, int len)

Syntax

StringWriter.write(char[] cbuf, int off, int len) has the following syntax.

public void write(char[] cbuf,  int off,  int len)

Example

In the following code shows how to use StringWriter.write(char[] cbuf, int off, int len) method.


/*from   ww w  .  j a  va2s  . c o m*/
import java.io.*;

public class Main {

   public static void main(String[] args) {

      char c = 'b';
      
      StringWriter sw = new StringWriter();

      // write chars
      sw.write('a');
      sw.write(c);

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


   }
}

The code above generates the following result.