Java IO Tutorial - Java PrintStream .append (CharSequence csq, int start, int end)








Syntax

PrintStream.append(CharSequence csq, int start, int end) has the following syntax.

public PrintStream append(CharSequence csq,   int start,   int end)

Example

In the following code shows how to use PrintStream.append(CharSequence csq, int start, int end) method.

//from   w  ww . j  av a2 s  .co  m
import java.io.*;

public class Main {

   public static void main(String[] args) {
      CharSequence csq = "from java2s.com";

      
      PrintStream ps = new PrintStream(System.out);

      // append our character sequences
      ps.append(csq, 6, 11);
      ps.append(csq, 0, 5);

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

   }
}

The code above generates the following result.