PrintStream Append1() Example

Appends the specified character sequence to this output stream.


PrintStreamclass Append1() method example. This example shows you how to use Append1() method.This method Appends the specified character sequence to this output stream.

Here is the code:-

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

public class Append1 {

    public static void main(String[] argsthrows IOException {
        String c = "Girish";
        //Creating FileOutputStream object
        FileOutputStream out = new FileOutputStream("/home/girish/Desktop/g/m.txt");
        FileInputStream fin = new FileInputStream("/home/girish/Desktop/g/m.txt");
        //Creating PrintStream object
        PrintStream ps = new PrintStream(out);
        //Appends the specified character sequence to this output stream.
        ps.append(c);
        System.out.println("Append successfully");
        for(int i=0;i<c.length();i++)
        {
            System.out.print((char)fin.read());
        }
        ps.close();
    }
}

Output of the Program
 Append successfully
Girish

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

HOME | COPYRIGHT | CONTACT US