PrintStream Append2() Example

Appends a subsequence of the specified character sequence to this output stream.


PrintStreamclass Append2() method example. This example shows you how to use Append2() method.This methodAppends a subsequence of the specified character sequence to this output stream.

Here is the code:-

/**
 * @Program that  Appends a subsequence of the specified character sequence to 
   this output stream.
 * Append2.java 
 * Author:-RoseIndia Team
 * Date:-10-Jun-2008
 */
import java.io.*;

public class Append2 {

    public static void main(String[] argsthrows IOException {
        String c = "Girish Tewari";
        //Creating FileOutputStream object
        FileOutputStream out = new FileOutputStream("m.txt");
        FileInputStream fin = new FileInputStream("m.txt");
        //Creating PrintStream object
        PrintStream ps = new PrintStream(out);
        //Appends the specified character sequence to this output stream.
        ps.append(c,7,13);
        System.out.println("Append successfully");
        System.out.print("String after Appending is :");
        for (int i = 0; i < c.length(); i++) {
            System.out.print((charfin.read());
       }
        ps.close();
    }
}

Output of the Program
Append successfully
String after Appending is :Tewari

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US