PrintStream Append() Example

Appends the specified character to this output stream.


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

Here is the code:-

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

class Append {

    public static void main(String args[]) throws IOException {
        char c = 'G';
        //Creating FileOutputStream object
        FileOutputStream out = new FileOutputStream("m.txt");
        FileInputStream fin = new FileInputStream("m.txt");
        //Creating PrintStream object
        PrintStream ps = new PrintStream(out);
        ps.append(c);
        System.out.println("Append successfully");
        System.out.println((charfin.read());
        ps.close();
    }
}

Output of the Program
Append successfully
G

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

HOME | COPYRIGHT | CONTACT US